Using qx in scrip to run a shell script?

I was curious if it is possible to use the perl ‘qx’ or similar command
inside of a custom action scrip to run a system level shell script. My goal
is to automate the process of restarting a system service or daemon. I
tried putting a couple of qx commands in the scrip. No errors, but no
restart either.

Peter

I was curious if it is possible to use the perl ‘qx’ or similar command
inside of a custom action scrip to run a system level shell script. My goal
is to automate the process of restarting a system service or daemon. I
tried putting a couple of qx commands in the scrip. No errors, but no
restart either.
Unless it’s poorly configured, your webserver should not be root and therefore
iughtn’t not have the rights to do this.

Although more complex, if I were keen on such functionality, I’d have the
script send a magic cookie to an alias connected to a script that does your
dirty deed. Security of said script is left as a a blanket for the user to throw
right out the door, but rejecting messages not originating on localhost would
be a start.

Otherwise have you considered shudder SNMP?
Cambridge Energy Alliance: Save money. Save the planet.

Yeah, probably a bad idea to be using RT scrips to do this from a security
standpoint, but when it didn’t work it peaked my curiosity. I’ll play with
rights to see if this is indeed the only reason it didn’t work…

Thanks for the reply!

PeterFrom: Jerrad Pierce [mailto:jpierce@cambridgeenergyalliance.org]
Sent: Friday, October 01, 2010 12:08 PM
To: Peter Roosakos
Cc: rt-users
Subject: Re: [rt-users] Using qx in scrip to run a shell script?

I was curious if it is possible to use the perl ‘qx’ or similar command
inside of a custom action scrip to run a system level shell script. My
goal
is to automate the process of restarting a system service or daemon. I
tried putting a couple of qx commands in the scrip. No errors, but no
restart either.
Unless it’s poorly configured, your webserver should not be root and
therefore
iughtn’t not have the rights to do this.

Although more complex, if I were keen on such functionality, I’d have the
script send a magic cookie to an alias connected to a script that does your
dirty deed. Security of said script is left as a a blanket for the user to
throw
right out the door, but rejecting messages not originating on localhost
would
be a start.

Otherwise have you considered shudder SNMP?
Cambridge Energy Alliance: Save money. Save the planet.

Hi.

I’m very sure executing external program from a scrip works. However, to be
safe you should use modules that catch all std streams or at very least make
sure you catch stdout of the program you exec.

Regards, Ruslan. From phone.

Yeah, probably a bad idea to be using RT scrips to do this from a security
standpoint, but when it didn’t work it peaked my curiosity. I’ll play with
rights to see if this is indeed the only reason it didn’t work…

Thanks for the reply!

Peter

-----Original Message-----
From: Jerrad Pierce [mailto:jpierce@cambridgeenergyalliance.org]
Sent: Friday, October 01, 2010 12:08 PM
To: Peter Roosakos
Cc: rt-users
Subject: Re: [rt-users] Using qx in scrip to run a shell script?

I was curious if it is possible to use the perl ‘qx’ or similar command
inside of a custom action scrip to run a system level shell script. My
goal
is to automate the process of restarting a system service or daemon. I
tried putting a couple of qx commands in the scrip. No errors, but no
restart either.
Unless it’s poorly configured, your webserver should not be root and
therefore
iughtn’t not have the rights to do this.

Although more complex, if I were keen on such functionality, I’d have the
script send a magic cookie to an alias connected to a script that does
your