| View previous topic :: View next topic |
| Author |
Message |
Talustus Voice
Joined: 28 Aug 2006 Posts: 5
|
Posted: Mon Jan 08, 2007 2:13 am Post subject: Services Control |
|
|
Hi @ all im not realy a coder but i need this i have writen a snippet but it didnt work whats wrong ? if Services are going down on one maschine i type !servcontrol and the bot will execute the command to start the services on the maschine but it says can not execute /home/test/sbnc/sbnc - permission denied so i would execute it as root
first snippet i have tested
| Code: | bind pub - !servcontrol pub_servcontrol
proc pub_servcontrol {nick uhost hand chan arg} {
putchan $chan "\00312...\00304trying to Start Services on Remote maschine "
set serv "/home/test/services/services"
eval exec $serv
}
| <<<<<< didnt work i get the error can not execute /home/... -permission denied >>>>>>>>>
second snippet
| Code: | bind pub - !servcontrol pub_servcontrol
proc pub_servcontrol {nick uhost hand chan arg} {
putchan $chan "\00312...\00304trying to Start Services on Remote maschine "
set su "su root"
eval exec $su
set pw "pw here"
eval exec $pw
}
bind pub - !servstart pub_servstart
proc pub_servstart {nick uhost hand chan arg} {
exec "/home/test/services/services"
}
|
but it didnt work it means su: wrong password but the pw is corect
some ideas or is there a script thats looks every half hour
if Services are online {halt}
if Services are offline exec /home/test/services/services |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Wed Jan 10, 2007 12:20 pm Post subject: Re: Services Control |
|
|
Why are you trying to execute the password?
| Talustus wrote: | | Code: | set pw "pw here"
eval exec $pw |
|
I imagine you want something like this (not tested): | Code: | bind pub n !test test
proc test args {
if {[catch {
set su [open "|su root -c /home/test/services/services" r+]
putlog "SU(1): [read $su]"
puts $su "rootpass";# CHANGE THIS
putlog "SU(2): [read $su]"
close $su
} err]} {
putlog $err
}
} |
...but having the root password in plain text in the script might not be such a bright idea.  _________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
|