EvilZone
Programming and Scripting => Scripting Languages => : lucid July 19, 2013, 04:04:18 AM
-
I have this script:
#!/bin/sh
## Erase contents of all files in /var/log
find /var/log -type f -exec sh -c '> "{}"' \;
## Erase contents of bash history and shutdown
cat /dev/null > .bash_history
shutdown -h now
It used to work, but now everytime I run it it gives me this:
Shutdown scheduled for Thu 2013-07-18 21:03:08 UTC, use 'shutdown -c' to cancel.
Which isn't really that big of a deal as that's only one minute away, but it never used to do that. Not only that, if I run shutdown -h now on it's own in the terminal it shuts down immediately. Why would it behave differently in the script than on it's own in the command line?
-
Er, reinstall bash
-
Why don't you use poweroff instead?
-
Why don't you use poweroff instead?
Arch.
Laptop or desktop?
-
I have this script:
#!/bin/sh
## Erase contents of all files in /var/log
find /var/log -type f -exec sh -c '> "{}"' \;
## Erase contents of bash history and shutdown
cat /dev/null > .bash_history
shutdown -h now
It used to work, but now everytime I run it it gives me this:
Shutdown scheduled for Thu 2013-07-18 21:03:08 UTC, use 'shutdown -c' to cancel.
Which isn't really that big of a deal as that's only one minute away, but it never used to do that. Not only that, if I run shutdown -h now on it's own in the terminal it shuts down immediately. Why would it behave differently in the script than on it's own in the command line?
Thats because I know you run arch.
These things are handled but systemd nowadays.
Use ; systemctl poweroff
Just throw something in your .bashrc to alias it.
-
Arch.
Laptop or desktop?
Laptop
Thats because I know you run arch.
These things are handled but systemd nowadays.
Use ; systemctl poweroff
Just throw something in your .bashrc to alias it.
Oh yeahhhhh. Totally forgot about that *facepalm*
Well, shutdown -h now used to work up until recently. Must have finally become depreciated.
-
Must have finally become depreciated.
*deprecated
(http://images.wikia.com/powerlisting/images/8/8f/Grammar_Nazi_Icon_Text.svg)
-
Oh really?
Depreciated: to lower in estimation or esteem (Webster's)
Deprecated: Computer Science To mark (a component of a software standard) as obsolete to warn against its use in the future so that it may be phased out. (Free Online Dictionary)
Seems you are right. Lol I've been pronouncing it as depreciated this whole time in my head.
EDIT: What the fuck!! proxx your advice didn't work like I thought it would. I changed it to systemctl poweroff and it still gives me the same output.
-
Oh really?
Depreciated: to lower in estimation or esteem (Webster's)
Deprecated: Computer Science To mark (a component of a software standard) as obsolete to warn against its use in the future so that it may be phased out. (Free Online Dictionary)
Seems you are right. Lol I've been pronouncing it as depreciated this whole time in my head.
EDIT: What the fuck!! proxx your advice didn't work like I thought it would. I changed it to systemctl poweroff and it still gives me the same output.
systemctl reboot
systemctl poweroff
System Commands:
default Enter system default mode
rescue Enter system rescue mode
emergency Enter system emergency mode
halt Shut down and halt the system
poweroff Shut down and power-off the system
reboot Shut down and reboot the system
kexec Shut down and reboot the system with kexec
That doesnt work ?
You sure you have the permissions ?
-
HOLY SHIT GUYS. You are all going to disown me as your EvilMate when I tell you this but it must be done so others can read this and not make the same mistake as I. I was running the alias command 'shutdown'. I just looked at my bashrc. Apparently I renamed it to wipedown some time ago and forgot.
So stupid.
-
Adding the full path to the binary you intend to run will usually bypass an alias.
-
Adding the full path to the binary you intend to run will usually bypass an alias.
Wait, do you mean adding the full path in bashrc? Sorry I'm a little tired.
-
In the script that you want to call shutdown.
-
In the script that you want to call shutdown.
Right. I'm slow sometimes.