cancel
Showing results for 
Search instead for 
Did you mean: 

Writing a script.

Community Veteran
Posts: 8,510
Thanks: 934
Fixes: 9
Registered: 02-08-2007

Writing a script.

I would like to put an icon on my desktop that would link to the following instruction, sudo poweroff followed by my password.
As I have no idea about scripts has anyone any idea how I might do this ?
Problem with the shutdown button in Mint 15 is that it sometimes does not shut down correctly ie: the Mint Logo remains on the screen. By typing the above in the terminal it shuts down correctly and whilst it's not a major task to shut down this way I keep forgetting hence my reason for wanting too placing a Icon on the desktop that would do this.
10 REPLIES
Community Veteran
Posts: 6,773
Thanks: 257
Fixes: 20
Registered: 16-02-2009

Re: Writing a script.

Right click on desktop, create text file.
Put in it

#!/bin/bash
gksudo shutdown 0

Save it as shutdown.sh.
Right click on it and choose properties, change to the permissions tab, click the executable flag.

VileReynard
Seasoned Pro
Posts: 10,976
Thanks: 265
Fixes: 11
Registered: 01-09-2007

Re: Writing a script.

You will still have to enter your password, though.
BTW I get no problems - if I don't press enter on the shutdown prompt, I get a 60 second countdown until it activates.

Community Veteran
Posts: 5,472
Thanks: 292
Fixes: 4
Registered: 11-08-2007

Re: Writing a script.

Rather than doing this script thing, have you considered setting the system reporting to verbose, and then read through the shutdown log file to see what is causing the hang up,  and then actually solve the problem rather than attempting a work around.
I had this issue years ago, and it turned out to be the reading of an acpi setting wasn't quite right, but that was easily overridden by adding a flag to one of the commands in the shutdown script, then the machine worked perfectly.
Community Veteran
Posts: 8,510
Thanks: 934
Fixes: 9
Registered: 02-08-2007

Re: Writing a script.

Stuck already !
On Rt Click desktop I get the following menu,
Create new folder
Create Launcher
Create New Document
Open in Terminal
Organize Desktop
Keep aligned
Show Hidden files
Paste
Add Desklets
Change Desktop Background.
Purleigh,
Thanks but that's way beyond me as I am fairly new to Linux.
Community Veteran
Posts: 6,773
Thanks: 257
Fixes: 20
Registered: 16-02-2009

Re: Writing a script.

The Third option/ Create New Document
Then Create text file
Community Veteran
Posts: 8,510
Thanks: 934
Fixes: 9
Registered: 02-08-2007

Re: Writing a script.

Solved, realised it was New Document that I needed .
First time I have ever used the Text editor !  Smiley
VileReynard
Seasoned Pro
Posts: 10,976
Thanks: 265
Fixes: 11
Registered: 01-09-2007

Re: Writing a script.

How do you change the logging level for shutdown?

Community Veteran
Posts: 5,472
Thanks: 292
Fixes: 4
Registered: 11-08-2007

Re: Writing a script.

VileReynard
Seasoned Pro
Posts: 10,976
Thanks: 265
Fixes: 11
Registered: 01-09-2007

Re: Writing a script.

Hmmmm
I was hoping for a parameter I could change somewhere.
Then have a look in syslog or similar.
Since I'm using Mint (Cinnamon) I'm going to do
Quote
sudo service mdm stop
sudo halt

Community Veteran
Posts: 8,510
Thanks: 934
Fixes: 9
Registered: 02-08-2007

Re: Writing a script.

Thanks to all for the help on this issue, some good links there !