How to use crontab command to turn off wireguard interface at a specific time?

Hello,
How to use crontab command to turn off wireguard interface at a specific time?
Debian,Ubuntu sever and Openwrt can use the same commnad?
Thank youo so much.
photo_2022-06-18_10-19-27

I want to disable wireguard interface at a specific time.Can help?Thank you so much.

ifdown wg0?

Don't forget to restart cron after adding entries to the file.

root@vhost:~# ifdown wg0
ifdown: unknown interface wg0

Hello,ifdown wg0 command not work.Any other solution?

So what's the name of your wireguard interface in openwrt ?

wireguard interface name is wg0

Hello,I find wg-quick down wg0 this command works.But how to work with crontab?Can you give me example?

ifdown wg0 ifup wg0 wg show

Work in OpenWrt as it is part of the wireguard tools package.

Is not part of OpenWrt wireguard tool

2022-06-18_003132

1 Like

Three different Architecture will require two or more cron types as the dependencies will vary.

https://archlinux.org/packages/extra/x86_64/wireguard-tools/

1 Like

that's what the links you were given, were for.

Hello,Why this command not work at Debian ?Can you give me a example ?I also need command works at Debian or Ubuntu.
Thank you.

What system are you running? Openwrt? Ask here. Debian/Ubuntu/other os’s… ask on forums dedicated to those platforms.

1 Like