Run bash commands script as cron
Hi
I want this batch-script run as cron. Code:
wget ftp://username:password@domain.com/file.zip Thanks |
first, make the bash script executable:
Code:
chmod u+x name_of_script Code:
crontab -e Code:
1 2 3 4 5 /path/to/bash-script 2: Hours (0-23) 3: Day (0-31) 4: Month (0-12 [12 == December]) 5: Day of the week(0-7 [7 or 0 == sunday]) which lets you set a time for which you want to run it... google will give you more info on the time-setting syntax for things like running a job every hour etc... I think this should do it... |
Pretty easy. Create a file and add this:
Code:
#!/bin/sh Next make it executable: Code:
chmod +x /home/anjanesh/my_script Code:
crontab -e Code:
0 2 * * * /home/anjanesh/my_script Hope that helps. |
Thanks. Yes. Im pretty much getting the cron setup using my control-panel CPanel.
I thought to run a bash script I'll need to do something like ./path-to-folder/script.sh ? zai - is the first line #!/bin/sh required ? Im having jailshell |
The first line is the path to the interpreter. You don't have to have it, but if you don't, then the command to execute the file will be a bit different:
Code:
/bin/sh /path-to-folder/script.sh |
All times are GMT -5. The time now is 04:04 AM. |