run bash command inside a cron job in ubuntu
That is completely possible. Just add the entry on the crontab file with crontab -e
using the correct user. You can also move your script at /etc/cron.hourly
. Just take in count that bash files under /etc/cron.hourly
will run under root
. If you want to run your script under a target user, use the crontab approach and make sure to provide the absolute path of your script and your user can execute the script. e.g
@hourly /my/bash/script.sh
#or
0 * * * * /my/bash/script.sh