[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

shutdown machine script noob

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 11
Thread images: 2

File: linux3.png (44KB, 640x480px) Image search: [Google]
linux3.png
44KB, 640x480px
Please I need help with this:


#!/bin/bash
#

su -l
shutdown -h now
>>
Just type rm -rf\
>>
>
>>
>>55870091
sudo shutdown -h now
add something in your sudoers to allow you to shutown without a password then fuck off to >>>/g/sqt or >>>/g/dpt
>>
File: shutdown.png (133KB, 1244x1092px) Image search: [Google]
shutdown.png
133KB, 1244x1092px
>>
>>55870091
here's your problem. "su" creates a whole new instance of the BASH shell running as root. However, the "shutdown" command is still being run by the "original" BASH process, ostensibly after the "su" command finishes. The "su" command won't finish until you log out of the "new" BASH session.

If you just want to run one command as root, instead of starting a new shell session as root, use "sudo."

"su" = "switch user"
"sudo" = "switch user and do something."
>>
>>55870091
#!/bin/sh
sudo shutdown -h now
>>
Try
poweroff

No need for root permission, at least in arch

You can also use init 6 to shutdown your machine IIRC.
>>
>>55871975
init 6 is reboot. init 5 is shutdown.
>>
>>55871953
>#!/bin/sudo shutdown -h now
>>
>>55870091
doas poweroff
Thread posts: 11
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.