When crontab execution is not normal on Ubuntu

Asked 2 years ago, Updated 2 years ago, 66 views

$ sudo crontab -l
37 * * * * source /home/jmkim/dms-bi/bi_venv/bin/activate && python /home/jmkim/dms-bi/run.py >> /home/jmkim/test.log 2>&1

I registered it on crontab. However, the execution did not continue, so I looked at the service cron status.

Oct 08 01:37:01 spark-master CRON[119498]: (root) CMD (source /home/jmkim/dms-bi/bi_venv/bin/activate && python /hon /houn/jim/rmans.py >> /home/jmkim/test.log 2>&1)
Oct 08 01:37:01 spark-master CRON[119491]: pam_unix(cron:session): session closed for user root

It came out like this. I don't know if it's session closed and it's not working.

Why doesn't the execution you ordered work? Direct command of /usr/bin/python/home/username/run.py will run normally.

ubuntu crontab linux

2022-09-20 19:53

1 Answers

The user name is source.

To set the execution of a specific user with sudo crotab-e, specify it as follows. 37 * * * * su source -c "/home/jmkim/dms-bi/bi_venv/bin/activate && python /home/jmkim/dms-bi/run.py >> /home/jmkim/test.log 2>&1"


2022-09-20 19:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.