Reputation: 1
i'm using the module python-crontab to create entries at the cron of one user.
I need execute a script.py with the apache user but also need don't use the cron of the apache user because we use it for important production uses and prefer don't mix and use other cron of other user.
But, when i try executing: (with the apache user that have sudo privileges):
cron = CronTab(user='ec2_user')
It returns: OSError: Read crontab ec2_user: must be privileged to use -u
Code is:
from crontab import CronTab
cron = CronTab(user='ec2_user')
command = "python3 /var/www/html/script.py"
job = cron.new(command=command)
job.setall(datetime(ano, mes, dia, hora, minuto))
cron.write()
How can i give permissions the user apache to write in other user cron? Thanks!
Upvotes: -5
Views: 36