Score:0

How to use a screen with bash script?

ng flag

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?

Score:0
pe flag

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

ng flag
Part of my problem was solved, put the `screen -dmS ast [command]` still not created
Gerrit avatar
cn flag
Are you on a system with selinux in enforcing mode, by any chance? Does getenforce exist and return something?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.