I want to schedule a CRON job into AWS Ubuntu instance. I have a simple cron sample like the following:
import pandas as greatPanda
import pprint
import uuid
df = greatPanda.read_csv('/home/soumik/appTornado/di/ABP/df.csv')
pprint.pprint(df)
name = '/home/soumik/appTornado/di/ABP/df_'+str(uuid.uuid4())+'.csv'
df.to_csv(name,index=False)
And I have set the CRON like the following with crontab -e into terminal:
*/1 * * * * python /home/ubuntu/ABP/abp_backend_processing/cronSample.py > /home/ubuntu/ABP/abp_backend_processing/cronlog.txt
The sample code has been run into my local machine with proper CRON functionality but can not find any luck into AWS instance.
2 Answers
To set up the cronjob for the user you have logged in for follow this steps
- log into the ssh console
- Open the crontab file by typing crontab -e
- close the file with changes you want to make. In your case the syntax is right.
- Once you close the file you can see that 'new crontab is installing' message you are done.
I think your Cron service not started. Try:
service crond start
You can check Cron service status with:
service crond status
Make sure your script file has execute permission.