Code: Select all
/system script job remove script_name
Code: Select all
no such item
1. How to extinguish all versions of a running script?
2. How can I write in the scheduler so that the script runs only once at startup?
/system script job remove script_name
no such item
Thanks, my second problem is solved thanks to your link. Before this, I almost never used the scheduler, and did not know that an interval equal to zero means launching only once.Or actually run the script only once on startup (use start-time=startup as per ROS scheduler manual).
Just the opposite. I don't want the script to run every minute. I'd like to leave an infinite loop. It is written to test the connection. Thanks to your tip, I can now run it only once in the scheduler. BUT I would like to understand just in case for future experiments. Is there anyway to stop the script or the loop in it using some command in the terminal or an additional script if my main script is launched through the scheduler.If it's run every minute, does it have to run in endless loop?
Thanks for the suggested option. I'll see if I can use it.If the goal is to test a connection... maybe netwatch would solve. The newer "icmp" check is pretty robust likely more than a script. Or perhaps using BFD might be a better approach than script.
Are you suggesting I make a global variable? This is probably one of the options, to make some kind of flag (variable). But I still wanted to understand JOBS.You can make a loop script that test i a variable is true.
Then you can just change the variable from 1 to 0 and the script stops.
It's not complete description, because on-event can contain script code, not just script name. Maybe this is changed through ROS versions but not updated in doc.
- on-event (name) - name of the script to execute. It must be presented at /system script
/system/script> export
...
add dont-require-permissions=no name=tst owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":delay 10"
/system/scheduler> export
...
add interval=30s name=tst on-event=tst policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=2023-11-02 start-time=\
23:01:30
/system/script/job> print
Columns: SCRIPT, OWNER, STARTED
# SCRIPT OWNER STARTED
0 admin 2023-11-02 23:02:12
1 tst admin 2023-11-02 23:12:00
2 admin 2023-11-02 23:12:00
/system/script/job> remove [find where script="tst"]
That's what I need. I didn't even have to create a script with a loop to iterate through all the names I needed.Code: Select all/system/script/job> print Columns: SCRIPT, OWNER, STARTED # SCRIPT OWNER STARTED 0 admin 2023-11-02 23:02:12 1 tst admin 2023-11-02 23:12:00 2 admin 2023-11-02 23:12:00 /system/script/job> remove [find where script="tst"]
/system/script/job>
/system/
/system>script/
/system/script/job>
/system/script
job/print
../scheduler/print
/interface/print
Yes, it can be used to control the running state of the script.Are you suggesting I make a global variable? This is probably one of the options, to make some kind of flag (variable). But I still wanted to understand JOBS.
viewtopic.php?t=197314#p1009493Or add ability to detect already running script to your script (I don't know if/how this can be done though).
I tried netwatch. Interesting thing. But:If the goal is to test a connection... maybe netwatch would solve. The newer "icmp" check is pretty robust likely more than a script. Or perhaps using BFD might be a better approach than script.
In principle, this is enough to interrupt the execution of a script launched from the scheduler.But basically the /system/script/jobs only tracks what was called by /system/script/run. If the action the /system/scheduler is a script name, as @optio suggests above, that still run/"invokes" the /system/script so that's why it's tracked in jobs.
If I understand correctly, then this is a type of flag that was proposed to be made above. This is suitable if you are making a new script. But I was interested in stopping a script that does not have such a flag.
Yeah this approach seem to be what your looking for.In principle, this is enough to interrupt the execution of a script launched from the scheduler.But basically the /system/script/jobs only tracks what was called by /system/script/run. If the action the /system/scheduler is a script name, as @optio suggests above, that still run/"invokes" the /system/script so that's why it's tracked in jobs.
I almost figured out sending messages to Netwatch, but I noticed that checking and restoring the link is slower than in my script, where there is an endless ping.If the goal is to test a connection... maybe netwatch would solve. The newer "icmp" check is pretty robust likely more than a script. Or perhaps using BFD might be a better approach than script.