If you are new to this, you will need to research bash scripting and the cron timer, this tutorial assumes you know what they are.
In the VU+ the environment variables that sets the link to dashboard from the command line file seems to be missing or not set properly. In the first instance change directories to the top level via the cd / command.
ie. if you run a script like this:
root@vusolo:/# ./myscript.sh {press enter}
you will get:
-sh: myscript.sh: not found
This tells you that it is attempting to use -sh dashboard by default. However when the script is there and chmod 755 so that it is executable, then the -sh variable does not seem to be passed correctly.
If you run:
root@vusolo:/# /bin/sh myscript.sh {press enter}
your script will run successfully.
So now you can create a simple script, i'm going to put it in the root just for simplicity.
Here is a sample script
#!/bin/sh
echo "micks updater"
rm /var/whatever/myfile
wget -O /var/whatever/myfile "http://www.wherever.com/lookup.php?file=theirfile"
echo "Done!"
Write this to a text based file and save it as myfile.sh , don't put any empty lines at the end, the bash handler in the VU+ interprets these as bad lines from root. (bash,dash,sh - are all dashboard like DOS command line interpreter the VU+ uses sh)
The script tells the interpreter which dashboard to use - ie "sh"
It then prints or echos to the telnet window "micks updater" so you can tell the script is running via telnet
It then deletes the old file, because wget will not overwrite it.
It now downloads the new file called "theirfile" and renames it "myfile" putting it in the directory I specified.
It then prints or echos to the telnet window "Done"
That is basically how to start scripting in the VU+
Now how to add that to the cron sheduler
How to do that?
The easiest way by far is to create another text file called cronjob.txt and enter into it what you want it to do.
for example:
0 */12 * * * myscript.sh
There must be 1 extra blank line at the bottom of this file (Unlike the script)
This tells the scheduler to run myscript.sh from /root every day / 12, in other words every 12hrs. To load this ftp it to you boxes root. Telnet to your box and cd / to root dir and type:
crontab cronjob.txt
You can check the cronjob has been accepted by typing
crontab -l
It will show you what has been added to the scheduler. Note that adding a new file overwrites the scheduler so new file must contain entries for jobs you want to keep running
Thanks to mickle
__________________