1
0 Comments

I’m working on many scripts. I add and remove “crontab -e” so many times. I add and remove scripts with crontab -e so many times. I tried to make an “Available/Enabled” structure for these.

Example:
This is my structure’s tree:

<span class="hljs-comment"># all scripts</span>
scripts/available/1.sh
scripts/available/2.sh
scripts/available/3.sh

<span class="hljs-comment"># enabled scripts </span>
scripts/enabled/1.sh -> scripts/available/1.sh
scripts/enabled/2.sh -> scripts/available/2.sh

Then I add this line to “crontab -e“:

* * * * * /home/user/scripts/enabled/* &> /dev/null

This is the output of sudo systemctl status cron.service :

CGroup: /system.slice/cron.service
             ├─17763 /bin/bash /home/user/scripts/enabled/1.sh /home/user/scripts/enabled/2.sh

At long last:

1.sh is working every minute, but 2.sh is not working.

I want to run scripts only from cron.

What can I do if I don’t want to make a script for “run script in a directory” with another script?

Askify Moderator Edited question April 16, 2023