delay in shutdown.sh

Tell us to improve our work

delay in shutdown.sh

Postby Rodney.McKay » Thu Jan 23, 2020 1:39 am

After a few weeks with Raspberry Pi, Carberry, and a 4x50W amplifier installed in my car, I'm very happy with my purchase but I've decided that I don't want it to shutdown so soon when the engine turns off. Frequently when I use my car, it's to make multiple short stops and I would prefer to pause the playing song when I park then resume when I return, without waiting for the unit to power on again.
I've tried changing "shutdown -h now" to "shutdown -h 123" in shutdown.sh, but it still powers off within about a minute after power to the ignition wire on the Carberry harness goes off - about the same time as it took with "now" for poweroff to complete. What am I missing?
Rodney.McKay
 
Posts: 2
Joined: Thu Jan 23, 2020 1:20 am

Re: delay in shutdown.sh

Postby Flynn » Sun Feb 02, 2020 11:02 pm

Hi Rodney,

shutdown is a Linux command, from the man page you have the following details :

The time string may either be in the format "hh:mm" for hour/minutes
specifying the time to execute the shutdown at, specified in 24h clock format.
Alternatively it may be in the syntax "+m" referring to the specified number
of minutes m from now. "now" is an alias for "+0", i.e. for triggering an
immediate shutdown. If no time argument is specified, "+1" is implied.


So, if you want to power it off after 5 minutes, use :

Code: Select all
shutdown -h +5


Regards
Flynn
 
Posts: 2
Joined: Mon Oct 28, 2019 6:26 pm

Re: delay in shutdown.sh

Postby Rodney.McKay » Mon Mar 09, 2020 4:17 am

Thanks anyway for trying to assist, but I did read the man page before posting, and correctly editing the shutdown.sh script has no effect. Replies from anybody who has attempted to reproduce the problem, with details about what you observed, would be appreciated. By the way, although it's included in the man page, the "+" in
Code: Select all
shutdown -h +t
(where t is some # of minutes) is optional, so I generally don't bother to include "+" in my shutdown commands, but I did try both ways in my edits to shutdown.sh before posting the first time, just to be sure.

So anyway, the problem is, the command
Code: Select all
shutdown -h #
works in the terminal as expected, but editing the Carberry shutdown.sh script to delay shutdown has no effect; something is still sending a shutdown immediately command, as evidenced by the fact that the power is off within a minute after the ignition is switched off. I'm guessing one would also need to edit the Carberry daemon in some way, but due to its complexity I don't want to spend the time to verify or disprove that, and then figure out what code to edit and how. For now, I've acquired an alternative 12v -> 5v power control PCB which definitely does support delayed shutdown, from another manufacturer. It doesn't have any of Carberry's other functionality, but for the "daily driver" multimedia Pi in my dashboard, delayed shutdown is a must have, and I'll use my Carberry in the garage only, connected to another Pi, to read OBD codes and hopefully, eventually, to clear erroneous trouble codes rather than pay a mechanic for an hour of labor, just to flip a bit. Still, it would be nice to get delayed shutdown working with the Carberry someday, so the unit permanently installed in the dash could also be my diagnostic computer.
Rodney.McKay
 
Posts: 2
Joined: Thu Jan 23, 2020 1:20 am

Re: delay in shutdown.sh

Postby Sportegan » Sat Mar 21, 2020 1:44 pm

Thanks for the help, Flynn ;)
Sportegan
 
Posts: 3
Joined: Sat Mar 21, 2020 1:25 pm


Return to Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest

cron