I have CentOS 7.6 on a virtual machine. there some bash script at
/opt which i need to run them with this user
dbuser. these scripts write their output in a folder. Using
crontab -e I put these in
dbuser crontab so they run every minute:
* * * * * /opt/share/scripts/Connections * * * * * /opt/share/scripts/Memory * * * * * /opt/share/scripts/Regular
when i check the output folder they are not changed every minute. when i run the scripts manually they run without problem and their output is updated correctly.
i checked all of directories and sub-directories to these scripts and they all have the full
/var/log/cron it says that commands are run and there is no error.
i also restarted
crond service after each change.
i also tried these:
* * * * * /usr/bin/bash /opt/share/scripts/Connections * * * * * /usr/bin/sh /opt/share/scripts/Connections * * * * * dbuser /opt/share/scripts/Connections
and i still get no update in output folders(these commands works fine manually).
finally i added this in root crontab and it is working correctly without error and updates the output files:
* * * * * /usr/sbin/runuser -l dbuser -c '/opt/share/scripts/Connections'
i can't add every user's crontab to root. i want them to be in their own crontab. why this happen and how i can fix it?
the scripts write to a place where user
dbuser has permission to write. i tested it.
this user is a database user so in the scripts i have the path of database command:
should i add this to the path that cronjob use?
no it doesn't send any mail. they produce reports of database status that is for later refer.