Hi guys

int he past, I had a script in /config/scripts which needed to run every 5 minutes.
As vyatta cleared the crontab with every boot, I made use out of the vyatta-postconfig-bootup.script script:

grep -q updater.sh /etc/crontab 2> /dev/null || echo "*/5 * * * * vyatta sudo /config/scripts/updater.sh" >> /etc/crontab

checking the /etc/crontab, it seems that this still works, as the crontab file gets updated with the needed command:

*/5 * * * * vyatta sudo /config/scripts/updater.sh

But: it doesn’t run.

I searched a bit and have seen that vyos has meanwhile integrated a task scheduler (GREAT idea).

How exactly does it work? I checked the wiki, but there is only a config guide.
Is any cron file updated? which one?

as you can see I run the script as user “vyatta” (is this user still there?) which in turn runs a sudo.

after a while I checked messages and see the following:

Dec 22 11:41:01 vyattahome cron[2000]: Error: bad username; while reading /etc/crontab

Hmm, really need to understand it a bit more :slight_smile:




vyatta user is now vyos.

I would recommend doing it with task scheduler. Just have it run your script



ahh, vyatta is now vyos … first “problem” :slight_smile:

I have seen the scheduler (like it), but how do I get a “sudo” in there?

this is the config:

task-scheduler {
         task TunnelUpdate {
             executable {
                 path /config/scripts/updater.sh
             interval 5

and this is the script:

##ip tunnel updating script 

cd / 
cd /config/scripts 

EXT_IPV4=`curl -s "http://v4.ipv6-test.com/api/myip.php"` 
OLD_IPV4=`cat ipv4.txt` 
if [ $OLD_IPV4 = $EXT_IPV4 ] ;then 
   echo "old and new ipv4 addr are the same ipv6 tunnel not updated" 
   echo "exiting" 
   exit 1 

   echo "external ip does not match, updating ipv6 tunnel" 
   echo $EXT_IPV4 > ipv4.txt 
   curl "http://ipv4.tunnelbroker.net/ipv4_end.php?ip=AUTO&pass=xxxxxxxx&apikey=yyyyyy&tid=zzzz" 
   echo "done, exiting" 
   exit 1 

user “vyos” should have access to it as it’s member of “vyattacfg” …

26083920 -rwxrwxr-x 1 adieball vyattacfg   14 Dec 23 03:35 ipv4.txt
26083921 -rwxrwxr-x 1 adieball vyattacfg  578 Jul  1 16:27 updater.sh

anything I’m missing here?




I don’t understand what process here needs sudo at all?

I would think that you would want to store this text file in the vyos user home directory where it owns the directory.



I learned that only stuff within /config is preserved when upgrading. Is this not true anymore?


works like a charm, even leaving the script in “config"scripts”. The problem was the user vyatta vs. vyos