exec module not seeming to run something
Hi all, I keep coming back with questions - hopefully I'll be able to answer someone else's soon! I am trying to run a simple command to fire off a network backup each time an admin logs off a switch via accounting. I'm only testing this as a concept for now. I have rancid installed on another server, merrily doing backups fine. I have a script local to the freeradius machine that fires off a backup script job via ssh for the switch in question using the exec module in the accounting section of the default VS: if ((NAS-Port-Type == Virtual) && (Acct-Status-Type == Stop)) { testssh } Modules/exec: exec testssh { wait = no input_pairs = request program = "/etc/freeradius/testssh.sh %{User-Name} %{NAS-IP-Address}" } /etc/freeradius/testssh.sh #!/bin/bash echo $1 $2 > /etc/freeradius/testssh.out echo `date +%T` >> /etc/freeradius/testssh.out sshpass -p password ssh $1@10.128.176.5 /usr/local/rancid/bin/rancid-run -r $2 echo $! >> /etc/freeradius/testssh.out exit 0 The problem is it doesn't work. I can run the script from a shell prompt and the backup functions fine, the variables outputting to the testssh.out file and the ssh command running ok. Freeradius fires the script off ok after an accounting session and the bits get written to the testssh.out file, including the PID of the ssh process but the command itself doesn't work. Am I missing something obvious (again)? Comments welcome on how clever/ridiculous this idea is! :-) Thanks Andy
Franks Andy (RLZ) IT Systems Engineer wrote:
The problem is it doesn’t work. I can run the script from a shell prompt and the backup functions fine, the variables outputting to the testssh.out file and the ssh command running ok. Freeradius fires the script off ok after an accounting session and the bits get written to the testssh.out file, including the PID of the ssh process but the command itself doesn’t work.
Am I missing something obvious (again)?
PATH Use the complete filename for all executables in the shell script. Alan DeKok.
participants (2)
-
Alan DeKok -
Franks Andy (RLZ) IT Systems Engineer