Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

[Solved / Archived] KIll Running Script from CLI

6 Posts
2 Users
0 Likes
117 Views
(@larry_gorham)
Posts: 9
Active Member Customer
Topic starter
 

Running Wittypi4 on raspi4b bullseye and I've tried several scripts but nothing works until the running script END time expires. Going the wittytPi.sh route works but requires to much time. Does anyone have a script that works? 

 
Posted : 02/04/2025 12:03 am
Topic Tags
(@admin)
Posts: 590
Member Admin
 

Posted by: @larry_gorham

nothing works until the running script END time expires

What do you mean, and what do you want to do?

Your description does not seem to match the topic titile.

 

 
Posted : 02/04/2025 6:03 am
(@larry_gorham)
Posts: 9
Active Member Customer
Topic starter
 

My problem requires building a schedule.wpi every day for the next day. When a script is running I want to replace it with a new script before the old one has reached the END time.  One simple script is just  to keep running till 2030 instead of shutting down in 30 seconds from the time scheduled by the old script. It doesn't change the shutdown time when I runScript.sh. Is there a simple way to do that with out going the WittPI.sh route. 

 
Posted : 03/04/2025 7:30 pm
(@admin)
Posts: 590
Member Admin
 

You need to copy your new schedule script file to (overwrite) the "schedule.wpi" file in the software installation directory, and then run the "runScript.sh" script.

 
Posted : 04/04/2025 11:59 am
(@larry_gorham)
Posts: 9
Active Member Customer
Topic starter
 

That was obvious from the manual, but I found the problem. Apparently WittyPi4 ignores some of the year data because copying my original del.wpi to schedule.wpi and ./runScript.sh did not prevent an imminent shutdown from the running script. It did throw an error which I missed earlier (sorry): "WittyPi cannot find the start time". So WittyPi ignored my change. I think the month is also ignored to some extent because wittyPi.sh only shows the day and time in start/stop times. The fix just required that I make the day and time to something reasonable as in the second example. My two devices are working well now. Thank you - Larry

#######  DID NOT WORK ################

# del.wpi

# Turn on Raspberry Pi at

BEGIN 2030-03-1 08:15:00
END 2030-03-31 22:42:00

ON D31 
OFF H23 

######################

#####  WORKED  ##################

# del.wpi

# Turn on Raspberry Pi at

BEGIN 2025-03-20 22:15:00
END 2025-12-31 22:42:00

ON D100 
OFF H23 

*********************************************

 
Posted : 05/04/2025 2:12 pm
(@larry_gorham)
Posts: 9
Active Member Customer
Topic starter
 

There is another issue with my goal to stop the shutdown since it happened again.

WittyPi didn't like the del.wpi above that worked before. Again I'm trying to interrupt a running script so it doesn't shutdown while I'm editing. I ran ./kl the script below:

#!/bin/bash
sudo cp /home/larry/wittypi/del.wpi /home/larry/wittypi/schedule.wpi
exec /home/larry/wittypi/runScript.sh

 

# del.wpi

BEGIN 2025-03-20 22:15:00
END 2025-12-31 22:42:00

ON D100 
OFF H23 

 

The system shutdown right away and I pressed the button to restart .  The kl script produced this which I'm printing from wittyPi.log:

--------------- 2025-04-07 13:46:07 ---------------
Schedule next shutdown at: 2025-06-28 22:15:00
/home/larry/wittypi/utilities.sh: line 392: /home/larry/wittypi/wittyPi.log: Permission denied
Schedule next startup at: 2025-06-29 21:15:00
/home/larry/wittypi/utilities.sh: line 392: /home/larry/wittypi/wittyPi.log: Permission denied

Is this the reason it still follows the old script? Why does it deny permission?

Finally, I ran kl again and this time it accepted the script and did work giving a different result in wittyPi.log:

--------------- 2025-04-07 13:46:30 ---------------
Schedule next shutdown at: 2025-06-28 22:15:00
[2025-04-07 13:46:29] Schedule next shutdown at: 2025-06-28 22:15:00
Schedule next startup at: 2025-06-29 21:15:00
[2025-04-07 13:46:29] Schedule next startup at: 2025-06-29 21:15:00
---------------------------------------------------

 

I'm simply asking for a script that always cancels the shutdown coming from a running script.

 

PS: I should add that this new problem has only happened once. - Larry

 

 

 
Posted : 07/04/2025 8:36 pm
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.