Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
An_Nguyen
Participant

Job Scheduler to stop and start the wsdnsd process on Gaia R80.10

We are experiencing DNS resolution problems on our Firewall and currently engaging TAC. However, there is not a fix at this moment except I have to manually reboot the firewalls or stop and start the wsdnsd process every few hours.

I wonder if there is a way to schedule a job to run the following two commands (expert mode) every day, at 6:30AM.

cpwd_admin stop -name WSDNSD -path "$FWDIR/bin/wsdnsd" -command "kill -SIGTERM $(pidof $FWDIR/bin/wsdnsd)"

cpwd_admin start -name WSDNSD -path "$FWDIR/bin/wsdnsd" -command "wsdnsd"

Thanks

0 Kudos
6 Replies
Danny
Champion
Champion

Sure. Pur them in a Bash script and source the CP environment, then run this script via Gaia‘a Job Scheduler at your prefered time.

0 Kudos
An_Nguyen
Participant

I don't know how to script... Can you please give detail instructions?

Thanks

0 Kudos
Danny
Champion
Champion

Ok, just put this script into a file named /home/admin/restart_wsdnsd

#!/bin/bash
source /etc/profile.d/CP.sh
if [[ -e /etc/profile.d/vsenv.sh ]]; then source /etc/profile.d/vsenv.sh fi
cpwd_admin stop -name WSDNSD -path "$FWDIR/bin/wsdnsd" -command "kill -SIGTERM $(pidof $FWDIR/bin/wsdnsd)"
cpwd_admin start -name WSDNSD -path "$FWDIR/bin/wsdnsd" -command "wsdnsd"

 Make the file executable with this command:

chmod +x /home/admin/restart_wsdnsd

And finally run this script via Gaia‘a Job Scheduler at your prefered time.

An_Nguyen
Participant

./restart_wsdnsd
./restart_wsdnsd: line 7: syntax error: unexpected end of file

I tried to run it but it returned an error.

Thanks

0 Kudos
An_Nguyen
Participant

#!/bin/bash source /etc/profile.d/CP.sh if [[ -e /etc/profile.d/vsenv.sh ]] then source /etc/profile.d/vsenv.sh fi cpwd_admin stop -name WSDNSD -path "$FWDIR/bin/wsdnsd" -command "kill -SIGTERM $(pidof $FWDIR/bin/wsdnsd)" cpwd_admin start -name WSDNSD -path "$FWDIR/bin/wsdnsd" -command "wsdnsd" exit 0
0 Kudos
An_Nguyen
Participant

I see the following result when the script runs, is that ok?

/home/admin/restart_wsdnsd: line 6: pidof: command not found

cpwd_admin:

Process WSDNSD (pid=22370) stopped with command "kill -SIGTERM ". Exit code 0.

cpwd_admin:

Process WSDNSD started successfully (pid=2701)

Thanks

0 Kudos