Hi folks,
I am very new to Linux. I want to set up a cron job to execute a bash script, below is what I think I shoul do after searching stuff on the Internet. I'd be much appreciated if anyone could point me out what is incorrect and anything else I need to do.
The scenario is SSH (I have access details) to the server, set up a cron job to execute a bash script at 3am every 48 hours. The bash script meant to change system current working directory to the one I specify and invoke a php script.
1. create a bash script search.txt (text file) which contains the following command. I want this bash script switch current working dicrectory to the one i specified below and invoke file sphider.php
Code:
#!/bin/bash
cd /home/gwcwater/public_html/sphider/admin
php spider.php full
2. I think I need to upload this bash script to somewhere on the server. is this correct? Where is the appropriate folder to place this file?
3. create a text file, contab.txt, which contains,
Code:
0 3 */2 * * [i know i need to specify the bash script file path here, but not sure how]
4. upload crontab.txt using ASCII mode (where is the appropriate palce to place this file on the server?)
5. SSH to the server
6. cd to the directory where contab.txt is stored
7. execute command: crontab contab.txt