You are not logged in.
Hello,
I wrote following shell script in order to restart vsftpd when my dynamic wan ip adress changes:
#!/bin/bash
oldip=`xxxdyndns.com +short`
while :
do
newip=`dig xxxdyndns.com +short`
if [ $newip != $oldip ]; then
echo "renewd ip. new ip: $newip"
oldip=$newip
systemctl restart vsftpd.service
fi
sleep 5m
done
exit 0
The script needs to be run with root privileges (due to the systemctl restart line).
I want the script to be run when my system starts, so I thought about writing a systemd service file. Unfortunately, I could not find out how to tell systemd that it shall run the script as root. I'm sure that this is a very novice question, but my board and google search did not tun out to be successful.
Last edited by vibee (2014-01-16 15:42:02)
Offline
Have you tried a service with
User=root
similar to e.g. https://wiki.archlinux.org/index.php/Sy … ces#Gitlab ?
Last edited by karol (2014-01-16 15:28:37)
Offline
Hooray, that's it. Thank you.
Offline