Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> Text file to Variable, Can't get a PID from a PIDFile into a shell variable
Matty87
post Jul 14 2008, 07:59 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 14-July 08
Member No.: 13,558



Hi all, hopefully someone can help me

I've got a script for a gaming server, the gaming server creates a PID file when it starts up (the only thing within the pid file is the number combo which is the current PID)
Anyway, i'm making a script which has the option to kill the server and i'm trying to read the PID file and put the PID into a variable so i can kill it with the kill command

Now i thought the way to do it was something like this

CODE
savedpid='cat $PIDFILE.pid'
kill $savedpid


but all i get saved as the variable is ='cat $PIDFILE.pid'
Thus kill spurts out a non-pid error

QUOTE
./start: line 42: kill: cat: arguments must be process or job IDs
./start: line 42: kill: $PIDFILE.pid: arguments must be process or job IDs


Can anyone tell me what the correct command is?
Everything i've managed to find on the net sez thats correct sad.gif maybe its the outdate OS that i'm running on (unfortunately due to a fool/idiot/moron hoster/owner the OS can't be updated/changed
I think its runnings some ancient copy of Debian Etch (an OS that isn't even really suited for gaming servers....)

Anyway, any help would be great
Thanks

ps, i would just kill everything with a wild card "killall <bleh>*" but unfortunately some of our machines have 2 or more servers within the same account so running that command would kill all the servers instead of just the one you want (which i know would be easily remedied by making multiple accounts, but the sys-op is a lazy fool who takes months just to add an IP to the shell access list....let alone make new accounts *gasp*)

Cheers
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies (1 - 1)
michaelk
post Jul 14 2008, 11:28 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,797
Joined: 23-January 03
Member No.: 360



Are you using backticks in your command? It is the key next to the 1 on standard keyboards.
Use ` not '

savedpid=`cat $PIDFILE.pid`
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th October 2017 - 01:44 AM