Rebooting devices on a schedule, How?

Status
Not open for further replies.

Scubadave112

Member
Jan 24, 2020
122
20
18
37
I have heard this question in the past and it was obviously for a workaround to another underlying problem and no one ever answered the original ask.

I have a SNOM PA1 and every few days it just stops working... I am calling it and it is not picking up. I reboot it (I just un-register it and that forces the reboot) and then it works again... I would love to work with ya'll to resolve this issue; however, I am curious about what kind of cron job or method I could use to unregister a specific device every night at 3am.
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
You can reboot a single phone from the command line with something like:

Code:
root@af-test3:~# fs_cli -x 'luarun app.lua event_notify internal reboot 201@testdomain.uk snom'
 

Scubadave112

Member
Jan 24, 2020
122
20
18
37
@Adrian Fretwell so that works perfect and I wanted to run this daily at 3am with a crontab so I created a .sh

Code:
#!/bin/bash
/usr/bin/fs_cli -x "luarun app.lua event_notify internal reboot 201@cxdomain.voip.com snom"

and it will say +ok if i run the .sh but it doesn't really run. I don't searched for a long time and don't know if im retarded or what but I can not get this to work.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,070
577
113
@Adrian Fretwell so that works perfect and I wanted to run this daily at 3am with a crontab so I created a .sh

Code:
#!/bin/bash
/usr/bin/fs_cli -x "luarun app.lua event_notify internal reboot 201@cxdomain.voip.com snom"

and it will say +ok if i run the .sh but it doesn't really run. I don't searched for a long time and don't know if im retarded or what but I can not get this to work.

Just run the command directly in a cron job, it should work, something like:

Code:
0 3 * * * /usr/bin/fs_cli -x "luarun app.lua event_notify internal reboot 201@cxdomain.voip.com snom" >/dev/null 2>&1
 
  • Like
Reactions: Adrian Fretwell
Status
Not open for further replies.