Anomaly in CRON execution of shell script

Chris Elvidge celvidge@outlook.com
Sat Dec 28 17:07:10 GMT 2024


I have a directory of files that I need the contained executables run 
from CRON. (Like run-parts.)

I have found that since 25/12/2024, when run from CRON, it doesn't 
differentiate between executable and non-executable files. I.e. tries to 
run the non-executables. It ran correctly on 24/12/2024, i.e apache2 and 
updatedb ran, rest skipped.

Check file (simplified bit of original):
$ cat bin/check-execute-bit
#!/bin/sh
cd $HOME/daily
for S in *; do
     [ -x "$S" ] && echo "$S : executable" || echo "$S : not executable"
done

Directory contents:
$ ls -l $HOME/daily
total 48K
-rwxr-xr-x 1 celvi celvi  625 Apr 24  2024 apache2
-rw-r--r-- 1 celvi celvi  15K Apr 24  2024 apt
-rw-r--r-- 1 celvi celvi  355 Apr 24  2024 bsdmainutils
-rw-r--r-- 1 celvi celvi 1.6K Apr 24  2024 dpkg
-rw-r--r-- 1 celvi celvi 2.2K Apr 24  2024 locate
-rw-r--r-- 1 celvi celvi 1.3K Apr 24  2024 man-db
-rw-r--r-- 1 celvi celvi 1.1K Apr 24  2024 ntp
-rw-r--r-- 1 celvi celvi  257 Apr 26  2024 passwd
-rwxr-xr-x 1 celvi celvi  932 Apr 24  2024 updatedb

Run from command line:
$ check-execute-bit
apache2 : executable
apt : not executable
bsdmainutils : not executable
dpkg : not executable
locate : not executable
man-db : not executable
ntp : not executable
passwd : not executable
updatedb : executable

Output from CRON running check-execute-bit:
apache2 executable
apt executable
bsdmainutils executable
dpkg executable
locate executable
man-db executable
ntp executable
passwd executable
updatedb executable


Anyone any ideas where I can look next for what is going wrong?


-- 

Chris Elvidge
N Yorks, UK


More information about the Cygwin mailing list