On 2023-05-23 13:46, Jonathan Clark via Cygwin wrote:
First off, many thanks to everyone who is putting in time and effort in making cygwin as wonderful as it is.

I'm trying to get what I think is a simple cron job working. So far all I've gotten is frustrated and confused. I'm sure I'm doing something stupid (probably more than one thing), but I don't know what. At this point I have tried many different twiddles and fiddles and so on, with no positive results. Any help gratefully accepted.

I am familiar with cron and crontabs on various flavours of UNIX, but this is my first attempt at getting a cron job working on cygwin.

I have DLed the cron package and gotten it running (possibly wrongly...).

There are no cron.allow nor cron.deny files that I can find.

I have set up a crontab which looks correct to me. I have tried many variants of the actual command - adding a specific shell invocation (having read somewhere that this needs to be a .exe file). The target script works just fine when invoked by hand. I have ensured that the crontab file is written in UNIX format. I have messed around with file permissions so that the target script is not writable, even by me.

However, nothing works. Either:

a) nothing is ever invoked - cronevents shows that the new crontab is loaded, but there's nothing there which shows that the specified command is ever run;

OR

b) I get a gnomic message about the crontab being UNSAFE.

I have a sneaking suspicion that the space in my Windows username may be the cause of the UNSAFE.

Along the way I have fallen over various other curiosities.

'crontab -u' just says "must be privileged", even though I'm running it from an Administrator account.

cron-config talks about using 'passwd -R'  as an option, but when I try this all I get is:
"Storing password failed: Function not implemented" which is unhelpful.

Apart from exhaustive search, there doesn't seem to be any way to search the cygwin mailing list archives - is there such a facility hidden somewhere?

Any help appreciated! cronbug.txt attached

Hi JC,

You do not appear to be running cron!

Did you set up by running `/usr/sbin/cron-config` from an elevated admin shell and starting with the default answers?

I would avoid trying `crontab -u USER` under Cygwin as ideas of admin don't 
match.

I or config script created empty /var/cron/cron.deny to allow all users (me) to use cron.

I started off using `crontab -e` and `crontab -l > ~/$USER.crontab` to update and save, but now just edit ~/$USER.crontab then `crontab ~/$USER.crontab` to reload.

In my crontab I set:

PATH=/usr/local/bin:/home/$LOGNAME/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH
MAILTO=...@...

and never try running anything but non-elevated Cygwin scripts and commands.

I also run cygserver, and syslog-ng with some tweaks, to avoid dealing with Windows event logs.

[To run elevated Cygwin or Windows scripts and commands, I use Windows Scheduled Tasks with the SYSTEM account, whether logged in or not, with highest privileges, running Windows %CYGWIN_ROOT%\bin\sh ... with script args or any other command, making no assumptions about any current directory or user mounts.]

--
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                -- Antoine de Saint-Exupéry

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to