SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Testing 'Run script'
Goto page 1, 2  Next
 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Testing 'Run script'
Author Message
laiko



Joined: 11 Feb 2010
Posts: 43
Country: India

Post Testing 'Run script' Reply with quote
I am trying out the third type of job: Run script (JavaScript, VBScript, JAL, Batch/shell Script)

In the Automation Script, I have:

Code:
#!/bin/sh

cat /fin/data/log | grep 'Y'
if  [[ $? -eq 0 ]]
then /fin/scr/Exec.sh Initiate
fi


In the authentication, I entered the user/password and the remote agent (Unix box).

It is failing (Exit -1). This is what I got from the debug.log
2010-03-07 16:58:14,560 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.ui.C.G.o0OO - show() : start
2010-03-07 16:58:15,278 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.ui.C.G.o0OO - show() : end

Please let me know what is wrong with this? Because when I run the same script in the remote agent itself (unix box), it is executing properly.
Thanks in advance.
Sun Mar 07, 2010 7:31 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7847

Post Reply with quote
The agent is likely failing to authenticate the user and so it cannot run the job. Which authentication method is currently selected for the agent, FTP or PAM? What do you get in the agent log file schedule.log?
Sun Mar 07, 2010 11:58 am View user's profile Send private message
laiko



Joined: 11 Feb 2010
Posts: 43
Country: India

Post Reply with quote
This is what I got from the scheduler.log:

Code:
7-Mar-2010 11:14:01 PM   2   7xScmRht5hhVbDPyGb3xspoWOaY=   9   Job1   Remote job started.
7-Mar-2010 11:14:08 PM   2   7xScmRht5hhVbDPyGb3xspoWOaY=   9   Job1   Agent "etlsrv" contacted.
7-Mar-2010 11:14:09 PM   3   7xScmRht5hhVbDPyGb3xspoWOaY=   9   Job1   Remote job failed. Exit code: -1


The authentication method is FTP. The same authentication method and details (user/password/remote agent) work when I save this script to a file.sh and execute using 'Run Program or Batch File':

/bin/sh -c "./file.sh"

and Start In: /fin/data/
Sun Mar 07, 2010 1:52 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7847

Post Reply with quote
That is from the scheduler log. What do you get in the log file on the agent computer? Does the agent have permissions to create and modify files?
Sun Mar 07, 2010 1:59 pm View user's profile Send private message
laiko



Joined: 11 Feb 2010
Posts: 43
Country: India

Post Reply with quote
Yes, the agent can create/modify files. As I mentioned, it runs properly when executed directly in the remote agent using the same authentication credentials.
Sun Mar 07, 2010 3:13 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7847

Post Reply with quote
The part of the log that you posted so far is from the scheduler system and it is not very interesting, it simply says that something didn't go well on the agent system and as a result the remote job failed.

Please post relevant part of scheduler.log from the agent system, related to the remote job execution. I'd like to see the specific error and reason for why this job fails. It is also a good idea to check debug.log file on the agent system. It may also have specific error messages and exceptions with a stack trace.
Sun Mar 07, 2010 5:14 pm View user's profile Send private message
laiko



Joined: 11 Feb 2010
Posts: 43
Country: India

Post Reply with quote
Ok, gotcha.. this is my script:

Code:
#!/bin/sh

touch /etls/scripts/sked/TEMP
exit 0


And here is the debug.log from agent:

Code:
2010-03-08 08:57:30,998 [Job #17 - sample1] DEBUG com.softtreetech.jscheduler.business.runner.BatchScriptJobRunner - runJob()
2010-03-08 08:57:30,998 [Job #17 - sample1] DEBUG com.softtreetech.jscheduler.business.runner.BatchScriptJobRunner - Saving work file /24x7_Scheduler/Queue/1104.sh
2010-03-08 08:57:30,998 [Job #17 - sample1] DEBUG com.softtreetech.jscheduler.business.runner.BatchScriptJobRunner - Work file saved
2010-03-08 08:57:30,998 [Job #17 - sample1] DEBUG com.softtreetech.jscheduler.business.runner.BatchScriptJobRunner - Updating work file permissions to 755...
2010-03-08 08:57:30,998 [Job #17 - sample1] DEBUG com.softtreetech.jscheduler.business.runner.ProgramJobRunner - execProcess(): command line [/bin/chmod 755 /24x7_Scheduler/Queue/1104.sh] in work directory [null]
2010-03-08 08:57:30,998 [Job #17 - sample1] DEBUG com.softtreetech.jscheduler.business.runner.AbstractJobRunner - runAs() username=admin   command=/bin/chmod,755,/24x7_Scheduler/Queue/1104.sh workDir=
2010-03-08 08:57:30,998 [Job #17 - sample1] DEBUG com.softtreetech.jscheduler.business.runner.AbstractJobRunner - exec : ./runas.pl,admin,/bin/chmod 755 /24x7_Scheduler/Queue/1104.sh,
2010-03-08 08:57:31,002 [Job #17 - sample1] DEBUG com.softtreetech.jscheduler.business.runner.ProgramJobRunner - waitForProcess(): start
2010-03-08 08:57:31,104 [Job #17 - sample1] DEBUG com.softtreetech.jscheduler.business.runner.ProgramJobRunner - waitForProcess(): end
2010-03-08 08:57:31,105 [Job #17 - sample1] DEBUG com.softtreetech.jscheduler.business.runner.AbstractJobRunner - isFailed(...) : exit code 179
2010-03-08 08:57:31,105 [Job #17 - sample1] DEBUG com.softtreetech.jscheduler.business.runner.AbstractJobRunner - isFailed(...) : Enumeration found [0]
2010-03-08 08:57:31,105 [Job #17 - sample1] DEBUG com.softtreetech.jscheduler.business.runner.BatchScriptJobRunner - Job completed with exit code 179. This exit code does not satisfy job exit code condition. Job failed.
2010-03-08 08:57:31,145 [Job #17 - sample1] ERROR com.softtreetech.jscheduler.business.runner.JobExecutorImpl - Job errors: Unable to create batch file. Extended error: Job completed with exit code 179. This exit code does not satisfy job exit code condition. Job failed.


I am running this job as 'Run script (JavaScript, VBScript, JAL, Batch/shell Script) - Batch Script - platform-dependent'.
Thanks in advance..
Mon Mar 08, 2010 1:03 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7847

Post Reply with quote
Thanks. Here is the root cause.

The agent is unable to set exec permissions for a work file, while trying to run
/bin/chmod 755 /24x7_Scheduler/Queue/1104.sh
while logging in as user admin

The OS is returning error code 179. Do you see anything wrong with that command?
Mon Mar 08, 2010 5:42 pm View user's profile Send private message
laiko



Joined: 11 Feb 2010
Posts: 43
Country: India

Post Reply with quote
Sorry, but I really dont understand why the error. My goal is to simply run a unix shell script using the 'Run script (JavaScript, VBScript, JAL, Batch/shell Script) - Batch Script - platform-dependent' job type.

Say, given the account ABC with password ABC in the Unix server unix.server.com.. and to run a simple shell script of:

Code:
 #!/bin/sh

echo "hello"


How hard/complex could it be??
Tue Mar 09, 2010 10:27 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7847

Post Reply with quote
It is the operation system that runs your batch/shell script, not 24x7. Here is how it works. 24x7 creates a workfile, sets proper permissions, and then runs that file. After completion, the workfile is deleted. In your case, 24x7 is unable to set file permissions and you need to fix that. Whatever account you use for the agent, that account needs to be able to create executable files in 24x7 Queue subfolders.


PS. The beauty of this method vs. static batch/shell files, is that the script can be deployed automatically to any system running 24x7 agent or scheduler, you don't need to maintain multiple copies in multiple places. You can do that all in a single place on the master scheduler. You can also safely put user names, passwords, and other sensitive data into the script, because it is stored in encrypted format within 24x7 job database file. People who access the operation system, cannot see that stuff. There are also other benefits.


Last edited by SysOp on Tue Mar 09, 2010 11:17 am; edited 1 time in total
Tue Mar 09, 2010 10:42 am View user's profile Send private message
laiko



Joined: 11 Feb 2010
Posts: 43
Country: India

Post Reply with quote
Ok, cool... am gonna test that once I catch the Admin to change the permissions...
thanks, mate!
Tue Mar 09, 2010 10:55 am View user's profile Send private message
laiko



Joined: 11 Feb 2010
Posts: 43
Country: India

Post Reply with quote
The 'root' owns the Queue subfolder. We installed 24x7 as root. The Queue folder itself has 'drwxrwxrwx' permission. But the workfiles have '-rw-r--r-- ' permission when they get created (by root) making it impossible for the Agent account to execute them.
In this case, how do we make the Agent account create the workfiles instead of 'root' so it can run them OR how can we make those files executable by Agent account when created by root.
Wed Mar 10, 2010 3:46 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7847

Post Reply with quote
It creates a text file first, that's why the initial permission is '-rw-r--r-- '
After that it executes chmod command trying to add execute permissions and that command files. Did you find why chmod fails? When you run it manually, doe it work for you?

By the way, you can also try changing the directory owner for 24x7 installation directory ( chown command). That may help.
Wed Mar 10, 2010 5:27 pm View user's profile Send private message
laiko



Joined: 11 Feb 2010
Posts: 43
Country: India

Post Reply with quote
Quote:
After that it executes chmod command trying to add execute permissions and that command files. Did you find why chmod fails? When you run it manually, doe it work for you?


How do I check why the chmod fails? Do you mean that 24x7 programmatically makes root execute chmod after creation to add execute permissions? It seems that is not happening at all. Where do we set it up?

I made the agent account own the Queue directory (not the entire installation though). Did not work..
Tue Mar 16, 2010 12:30 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7847

Post Reply with quote
Please try logging in as that user. Create a text file test.sh Queue directory and then try executing chmod 755 test.sh. Please let us know what you get.
Tue Mar 16, 2010 1:09 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.