Need advices on scripting for remote servers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need advices on scripting for remote servers
# 1  
Old 09-23-2009
Need advices on scripting for remote servers

Hi guys, I need some advice and recommendations for a work project I am doing. Let me state that security is not a concern as this is a closed network and the data is not sensitive.

Here's what I would like to do and how I was planning to accomplish it: I have an application on my remote servers that takes inputs and runs in the background with "&", it needs the kill command to terminate and generate its log file. Inputs are gathered from users on a web server and a shell script is created and SCPed to the remote servers, then the shell script is executed.

Within the shell script the command to run the application w/ its inputs is executed, next I capture the process ID...

myapplication -switches -filepath &
tempvar=&!

Next I need to set a cronjob to kill this process at a given time (also input by the users), so another file is created on the web server and SCPed, cronsetup.txt

in this file I have (for example user enters 5:30 am on September 23rd) :

30 5 23 9 * kill &tempvar

Now I was thinking to add this to my script so that when the initial script runs, it will set up the cron job, so....

myapplication -switches -filepath &
tempvar=&!
crontab cronsetup.txt


My question is, WILL THIS WORK???? is there an easier and quicker way to do all of this, am I just overdoing the process.

Recommendations please....
# 2  
Old 09-24-2009
Using cron for a one-shot command is definitely overkill. Just use at, eg
Code:
myapplication -switches -filepath &
PID=$!
echo "kill -TERM" | at 0530 23092009

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script for remote servers

Hi , I have written a small script : set -x #!/bin/ksh for i in `cat /tmp/list` ( list contains remove servers ) do ssh -t $i << EOF uname -a cd ~user echo "Enter the dir >" read dir path=`ll -ld /home/user/"$dir"` if ; then echo "Dir exists " read rm $path else echo "no such... (9 Replies)
Discussion started by: kpatel786
9 Replies

2. UNIX for Dummies Questions & Answers

Help with Copying files between two remote servers

Hi All, Please help me for a shell. I am a New to unix I am trying to DB dump file from one server and copying it to another server. From My Local ServerA connecting to remote ServerB using ssh and taking dump of a instance. That Dump file i need to copy to ServerC. I am able to connect... (6 Replies)
Discussion started by: maddyd2k
6 Replies

3. Shell Programming and Scripting

Help with script to reach remote servers

new3=`cat /tmp/list3` for pol in "$new3" $(su - dbadmin -c "ssh $new3 '/usr//llist'"); do export policy=`echo $pol`; su - dbadmin -c "ssh $x '/usr/policycmd $policy -L |grep -i active; echo $policy'">>/tmp/listxyz;done I am having trouble with this testscript as the file list3 has two names... (1 Reply)
Discussion started by: newbie2010
1 Replies

4. Shell Programming and Scripting

C shell scripting, check if link exists on remote servers

Hi, I'm new to C Shell programming. I'm trying to check if a sym link exists on remote server if not send email. I'm not having much luck. Can anyone help? Here is what I have written but it doesn't work. It tells me that my variable was not defined. Here is part of the script, the second... (0 Replies)
Discussion started by: CDi
0 Replies

5. Shell Programming and Scripting

Executing scripts on remote servers

Hello all, I'm typing away a script that will send a script to a remote host and execute it. This is what i have at the moment and i was wondering if i can improve that or thats basicly what everybody does. Using bash on RHEL 5.5 To over simplify it... #!/bin/bash # start_ () { ... (3 Replies)
Discussion started by: maverick72
3 Replies

6. AIX

Connect HMC to remote servers

I'm trying to connect a few servers in different remote locations to my HMC. I added static IPs to the Service Processor through ASM, and did all the necessary network configurations, then connected those servers to our switch. Now my questions are: - in our site, do I need to connect these... (4 Replies)
Discussion started by: Dardeer
4 Replies

7. Shell Programming and Scripting

Status of remote servers

hi, Say me the command to check the status of server. whether its up or down (11 Replies)
Discussion started by: satheeshkr_cse
11 Replies

8. Shell Programming and Scripting

Copy a file on remote servers

Hey Unix Gurus, I'm having trouble in copying a file on 5 different servers, first how can you do it locally (i.e without the need to ssh to the server you want to copy the file) and if you need to ssh how do u run a command within that server. Please see my code below(it doesn't work somehow).... (10 Replies)
Discussion started by: sexyTrojan
10 Replies

9. SuSE

Amber Lights + Remote Servers

Ok, so we get reports from operations after they do walk throughs about servers with amber or red lights showing. They want us to resolve the issues. On Solaris I can run prtdiag to identify the amber lights and clear them (replace hardware or "reboot" the daemon). How do I remotely figure out... (1 Reply)
Discussion started by: BOFH
1 Replies

10. Shell Programming and Scripting

Connecting to remote servers

Please advise, The previous thread asked about the automated transfer of files between two servers. The question is - is there any way of encrypting the password within the script or is it a matter of setting the permissions settings on the script so that it can only be executed and possibly... (1 Reply)
Discussion started by: rdbooth
1 Replies
Login or Register to Ask a Question