Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

Cron doesn't work!

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Windows - UNIX Interop] >> System & Network Admin Forum >> Cron doesn't work! Page: [1]
Login
Message << Older Topic   Newer Topic >>
Cron doesn't work! - May 4, '04, 8:33:36 PM   
trowling

 

Posts: 9
Joined: May 4, '04,
Status: offline
I can't get cron to do anything in either the Windows or Posix shell on SFU 3.0.

I am trying to run the following:
* * * * * ksh -c date > /dev/fs/C/SFU/datetest.log

ie: just a simple test script!

I can do a crontab -e and edit my job, I can do a crontab -p and set my password, and I can do a crontab -l and look at my job ... but NOTHING HAPPENS!! in either windows or Posix!
(The usr/lib/cron.log has entries showing my edits, successful password changes, and lists)

Any help what so ever would be greatly appreciated, I have wasted nearly 5 days on this so called software so far ...


Regards,
Post #: 1
RE: Cron doesn't work! - May 4, '04, 9:49:11 PM   
markfunk

 

Posts: 669
Joined: Mar. 31, '03,
Status: offline
Just to clarify - there are 2 different cron daemons - one for Windows and one for Interix.
Looks like you want the one for Interix.
So, make sure you are using an Interix shell and you are using the /bin/crontab utility.

Then do a "ps -efwwX unix" and check that the Interix /usr/sbin/cron daemon is running and that it is running as local Administrator.

Make sure there is no /usr/lib/cron/cron.allow file.
Make sure your name isn't in the /usr/lib/cron/cron.deny file.

(in reply to trowling)
Post #: 2
RE: Cron doesn't work! - May 4, '04, 11:02:49 PM   
Rodney

 

Posts: 3696
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
In the script should also specify the date utility with a
full path (/bin/date). It's good form since you can't always
guarantee that PATH will be what you want.

(in reply to markfunk)
Post #: 3
RE: Cron doesn't work! - May 5, '04, 12:49:19 AM   
trowling

 

Posts: 9
Joined: May 4, '04,
Status: offline
I would preferr to run it as the Windows Cron service, as I'm starting up someNT dos box's with Listeners and channel starts for MQSeries (ie: Start "LX" xxyyzz.exe -tpc), and I don't think you can do this in the posix shell??

I have advanced to the point where I can see the cron job failing every minute in the Event Viewer with the following:

Cron Service: CreateProcessAsUser() failed with error '1314'. user =
Gateway, doamin = , cmd to execute = CMD.EXE /C date >
/dev/fs/D/SFU/Scripts/datewin.log

I've given the user(Gateway) every right I can think of but it still fails .... ??

As for the Posix side of things:

I tried your suggestions and looked for the cron running as local administrator, but it is not there! ... only the following:

Administrator /usr/bin/init
Gateway /bin/ksh -l
+SYSTEM /usr/sbin/zzInterix
Administrator /usr/sbin/syslogd
Administrator /usr/sbin/inetd
Gateway ps -efwwX unix


Thanks for the quick response .... much appreciated ...


Regards,

(in reply to trowling)
Post #: 4
RE: Cron doesn't work! - May 5, '04, 1:25:57 AM   
markfunk

 

Posts: 669
Joined: Mar. 31, '03,
Status: offline
Ok, you're mixing up the environments.
Interix is the UNIX environment. It has the /dev/fs/C/... filename syntax.
The other env. is Windows - it has the c:\... filename syntax.

So you want to use the Windows cron service. Fine.
Then just stick to using Windows tools until you get this up and running. Then you can experiment with trying to start up Interix utils if that's what you really want.

If you're getting the event log error messages then you know the Windows cron service is running.
You can ignore the Interix cron daemon. These two cron programs are completely independent and don't conflict with each other.

So let's focus on Windows cron.
Looks like you've been using the %SFUDIR%\common\crontab.exe program to set up your crontab. That's good. Looks like everything is working fine.
Let's look at your crontab file and the command you want to run.

Remember that this is the Windows cron service. Which means you're going to get a Windows environment. Which means you should expect to get Windows commands - not the Interix/UNIX ones.
You command of "ksh -c date > /dev/fs/C/SFU/datetest.log" is more suited for the Interix cron environment - not the Windows one.
This command is problematic in the Windows world in lots of ways:
a) ksh without the -l option won't get you the full UNIX env. you want.
b) this command is executed by cmd.exe - so the pathnames need to be in Windows format - like c:\sfu\datetest.log .
c) the date command you're going to get (if you get it at all) is probably the Windows one. It works differently than the UNIX one.

So, how about using the command line "date /t > c:\datetest.log" for starters. Does this work ?
If not, then try something more fundamental like "dir > c:\test.log".
Once this is working then you can try Interix commands in your crontab. Commands like "ksh -l -c /bin/date > c:\datetest.log"

(in reply to trowling)
Post #: 5
RE: Cron doesn't work! - May 5, '04, 2:35:42 AM   
trowling

 

Posts: 9
Joined: May 4, '04,
Status: offline
When I run the dir > xxx.log as a cron job, I get the following in the Event Viewer:

Cron Service: CreateProcessAsUser() failed with error '1314'. user =
Gateway, domain = , cmd to execute = CMD.EXE /C dir >
d:\sfu\scripts\mydir.log

I also get another alternate event as follows:
Cron Service was unable to schedule the job 'dir >
d:\sfu\scripts\mydir.log' of user 'Gateway'.


Regards,

(in reply to markfunk)
Post #: 6
RE: Cron doesn't work! - May 5, '04, 2:47:07 AM   
markfunk

 

Posts: 669
Joined: Mar. 31, '03,
Status: offline
This error is a 'privilege error'.
But I'm not sure who needs the privilege - the cron service or the 'gateway' user.

If you look at your "Windows Cron Service", which user is used to start this service ? Is it the "local system account" ?

(in reply to trowling)
Post #: 7
RE: Cron doesn't work! - May 5, '04, 4:28:26 AM   
trowling

 

Posts: 9
Joined: May 4, '04,
Status: offline
Hi

I have left work for the day and won't be back till Friday unfortunately, but I ran it up on my Win2000 server this afternoon when I got home, and the cron seems to be woking fine here using the Local system account with 'allow service to interact with desktop' enabled also.

I noticed it started working at home on the Win2000 server after I did a cron -remove and then a cron -install ??

The system at work is WinNT 4.0, so there may still be some issues, I'll get back to you on Friday with an update.

Thanks very much for the help so far .... much appreciated ..


Regards,

(in reply to markfunk)
Post #: 8
RE: Cron doesn't work! - May 6, '04, 8:39:21 PM   
trowling

 

Posts: 9
Joined: May 4, '04,
Status: offline
Hi again

Well I'm back at work and it still doesn't work in the NT environment.

I'm getting the following in the event viewer when loged on as the administrator and running the Cron Service as the Administrator:

Cron Service function 'RtlAdjustPrivilege' failed
Cron Service function 'SecRegister' failed
Cron Service Win32 API LogonUser failed with error 1314, ogon failure: user = Administrator, domain - .
Cron Service was unable to schedule the job 'dir > c:\temp\dirtest.log of user 'Administrator'.

The Cron Service is running as the administrator, and I'm setting up the cron job as the administrator


When I run the Cron service as the Gateway user (in admin group) I get the same 1314 error, but different functin errors ...

When I run the Cron service as the Local System user I don't get errors in the event viewer, but nothing happens ....


This must be a rights issue ... is there a default setup specified anywhere ?


Regards,

(in reply to trowling)
Post #: 9
RE: Cron doesn't work! - May 6, '04, 11:25:20 PM   
markfunk

 

Posts: 669
Joined: Mar. 31, '03,
Status: offline
The Windows cron service is designed to run as local SYSTEM. Not sure if it will work as Administrator.
So change service to using local System.
I think you can do the following commands:
cron -stop
cron -remove
cron -install
cron -start

Recheck your crontab file to make sure you are just using Windows commands.
Recheck that you ran rshpswd and that you have the correct password.

Try again.
If it still isn't working, you might try changing the password to an incorrect value and see if you get any errors in the Event Log.
(just to validate that cron service is running ok)

(in reply to trowling)
Post #: 10
RE: Cron doesn't work! - May 7, '04, 12:15:36 AM   
trowling

 

Posts: 9
Joined: May 4, '04,
Status: offline
Mark

Thanks for persevering with me ...

How important is rshpswd ?
I haven't been using it so far (don't even know where it is located)

I have be using crontab -p even though it appears to be Interix specific in the documentation
I assumed that when I did a crontab -e in the windows shell and it asked me for my password before I edited the cron job, that I was setting the password ?

(I also do a crontab -p after saving the job, but I don't really believe this is doing anything because as I mentioned, it appears to be Interix specific .. but I do it anyway just for the sake of doing it etc... )


Regards,

(in reply to markfunk)
Post #: 11
RE: Cron doesn't work! - May 7, '04, 3:00:34 AM   
trowling

 

Posts: 9
Joined: May 4, '04,
Status: offline
a quick update ...

After much frustration, I removed SFU 3.0 comletely and deleted all directories associated with it.
I reinstalled the entire package with no errors as the administrator and started the cron service as the default ... system account

My crontab is:
* * * * * dir > c:\sfu\scripts\dirgwaytest.log

I now get the following when it runs every minute:
Cron Service: CreateProcessAsUser() failed with error '267'. user =
Gateway, domain = , cmd to execute = CMD.EXE /C dir >
c:\sfu\scripts\dirgwaytest.log


P.S I'm starting to believe that this truly is the software from hell !!


Regards,

(in reply to trowling)
Post #: 12
RE: Cron doesn't work! - May 7, '04, 8:42:04 AM   
markfunk

 

Posts: 669
Joined: Mar. 31, '03,
Status: offline
Sorry about mentioning rshpswd. crontab -p is the correct thing to do.
There are two crontab utilities - the Windows one and the Interix one.
You should be using the Windows one. It is found at %sfudir%/common/crontab.exe.
And "crontab -p" is very important. If you do not register your correct and valid password then commands in your crontab file will never successfully execute. The cron service needs this password to properly impersonate you and to properly run your commands.

I think error 267 is "Invalid Directory name"
These error codes should be the GetLastError() function codes which can be looked up on msdn.microsoft.com

(in reply to trowling)
Post #: 13
RE: Cron doesn't work! - May 7, '04, 8:47:46 AM   
jimraf

 

Posts: 17
Joined: Apr. 22, '03,
From: Boston, MA
Status: offline
Just a silly suggestion but does the user have change ACLS/permissions on C:\SFU\scripts?

(in reply to markfunk)
Post #: 14
RE: Cron doesn't work! - May 9, '04, 11:32:33 PM   
trowling

 

Posts: 9
Joined: May 4, '04,
Status: offline
Re 'does the user have change ACLS/permissions on C:\SFU\scripts' .... the user has admin full control rights to the SFU directory and all sub directories. I have tried it loged on as the user and as the administrator .. both fail ...

I have just re-installed SP6a, DSClient, and SFU 3.0 completely ...

Logged on as the Administrator, I can start and stop the cron service, I can create a crontab job etc ... but nothing happens, it just sits there ... no test file created ... no activity in the event viewer ... nothing!

Logged in as the Gateway user, I can start and stop the cron service, I can create a crontab job etc, ... then I get the following in the event viewer every minute:

Cron Service: CreateProcessAsUser() failed with error '267'. user =
Gateway, domain = , cmd to execute = CMD.EXE /C dir >
c:\sfu\scripts\dirgwaytest.log


Has anyone, anywhere, at any time, ever got this stuff working on Windows NT 4.0 ???

Just wondering ... it works just fine on my WIN2000 server, but I'd really like a confirmation before I waste another two weeks .....


Regards,

(in reply to jimraf)
Post #: 15
RE: Cron doesn't work! - May 10, '04, 1:51:07 AM   
trowling

 

Posts: 9
Joined: May 4, '04,
Status: offline
Quick update

Does SFU 3.0 need a domain to loginto ?

This box is running as a stand alone NT server, the name of the server is SWIFTDEV1,
but it just puts Gateway and Administrator in the cron.allow file. (Note: I have added an entry for SWIFTDEV1/Gateway and SWIFTDEV1/Administrator also)
When you run up the Posix side of things, it adds SWIFTDEV1+Gateway in the cron.allow under the usr\lib\cron directory.

When it works on the WIN2000 box, it has a domain to log into.

I'm wondering why we would need DSClient as a prerequisit before installing, if there is no domain to login to ?


Regards,

(in reply to trowling)
Post #: 16
Page:   [1]
All Forums >> [Windows - UNIX Interop] >> System & Network Admin Forum >> Cron doesn't work! Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.156