0

I tried to create an executable .sh file with command that create screen like this:

screen -dmS ast [comand]

And let my crontab execute it like this

* * * * * bash /root/my_bash.sh

But nothing executed, but with normal console command bash /root/my_bash.sh it's working successfully.

How can I fix it?

0

1 Answer 1

0

There is something wrong about how you ran the script from the crontab.

"Cron Job" by xmodulo is licensed under CC BY 2.0

As per your issue description it looks the crontab try to use the bash command as the script.

For example:

To schedule the backup script to run every night at 2am, open the root user's crontab:

$ sudo crontab -e

then enter the following:

0 2 * * * /etc/scripts/backup.sh

For example, if you have a script that needs to create a file from the dmesg command once a day at 1pm, your entry looks like the following:

0 13 * * * /usr/bin/dmesg > ~/dmesg.txt

Try to removing the bash from the line in crontab

2
  • Part of my problem was solved, put the screen -dmS ast [command] still not created Nov 29, 2021 at 17:25
  • Are you on a system with selinux in enforcing mode, by any chance? Does getenforce exist and return something?
    – Gerrit
    Nov 30, 2021 at 7:42

Not the answer you're looking for? Browse other questions tagged .