This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Script to initialize cron


Hi all,

I created an init script for cron I run Mondays when I reboot my
computer. It's just a wrapper for cron-config that calls the latter
with a random password:

# these privileges are missing on reboot
# no luck in searching for solutions as of 8/10/2015

for priv in SeAssignPrimaryTokenPrivilege SeCreateTokenPrivilege
SeServiceLogonRight; do
    if ! editrights -lu cyg_server | grep "$priv" > /dev/null; then
        echo "Adding $priv..."
        editrights -au cyg_server "$priv"
    fi
done

declare CYG_SERVER_PASSWD
CYG_SERVER_PASSWD="$(rstring 12)"

#printf "Using password: %s\n" "$(printf "*%.0s" $(seq 1
${#CYG_SERVER_PASSWD}))"
echo "Using password: $CYG_SERVER_PASSWD"

cron-config <<EOF
yes
yes

no
no
no
$CYG_SERVER_PASSWD
$CYG_SERVER_PASSWD
yes
EOF

rstring is just a one-liner to get a random string of length $1, or 16
if not supplied. Running this as local admin, I get the attached
output. My question has to do with the logon failure when trying to
start the service.

Subsequently running cron-config directly (and supplying the same
answers) starts the service as expected.

Running cron_diagnose ...
... no problem found.

Do you want to start the cron daemon as a service now? (yes/no) yes
OK. The cron daemon is now running.

Can anyone provide insight on this error?

Much appreciated,
Andrew

Attachment: cron-output.txt
Description: Text document

Attachment: cronbug.txt
Description: Text document

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]