Script that restarts the X Server, reboots the computer?

Moderator: BarryK

Post Reply
User avatar
pp4mnklinux
Posts: 1141
Joined: Wed Aug 19, 2020 5:43 pm
Has thanked: 638 times
Been thanked: 289 times

Script that restarts the X Server, reboots the computer?

Post by pp4mnklinux »

Hello everybody:

Usually I must restart X server to update changes, and in EasyOS_daedalus I must right click, go to ShutDown, Rectify, Restart X server.

How can I create a script to restart x server in one click?

If possible... how to create one to REBOOT COMPUTER?

---------------------------
You helped me to create a suspend script, so now I only need to click on a Direct Access to suspend computer.

How can I do this fot RESTART X SERVER ??

N.b.- Suspend script was:

Code: Select all

#!/bin/sh
# Set suspend:

echo -n mem >/sys/power/state

----------------------------

Can you tell me all the code I must write in the Script? (copy and paste)

Thanks in advance

Last edited by pp4mnklinux on Mon Oct 21, 2024 7:50 am, edited 1 time in total.

PP4MNK

User avatar
amethyst
Posts: 2421
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 506 times

Re: Restart X Server

Post by amethyst »

The command for restarting X is

Code: Select all

restartwm

and for reboot

Code: Select all

reboot

Right-Click in a folder where you want to create the scripts, select New and then Script to create scripts with the mentioned codes.

Last edited by amethyst on Mon Oct 21, 2024 7:32 am, edited 1 time in total.
User avatar
pp4mnklinux
Posts: 1141
Joined: Wed Aug 19, 2020 5:43 pm
Has thanked: 638 times
Been thanked: 289 times

Re: Restart X Server

Post by pp4mnklinux »

Thanks @amethyst

Restart X

Code: Select all

#!/bin/sh
# Set restartX:

#!/bin/bash
sudo restartwm

But I have a problem with the reboot option.- It doesn't work for me... I must write it incorrectly .... can you write me the code, plz

I used this:

Code: Select all

#!/bin/sh
# Set reboot:

#!/bin/bash
sudo reboot

PP4MNK

User avatar
amethyst
Posts: 2421
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 506 times

Re: Restart X Server

Post by amethyst »

@pp4mnklinux This works for me in Puppy. See attached.

Attachments
Scripts.zip
(357 Bytes) Downloaded 19 times
User avatar
pp4mnklinux
Posts: 1141
Joined: Wed Aug 19, 2020 5:43 pm
Has thanked: 638 times
Been thanked: 289 times

Re: Restart X Server

Post by pp4mnklinux »

Sorry @amethyst but the zip has no files in it (it is empty), but no worries, It is enough with restart x server.

Thanks

Attachments
Capture 12_23_34.png
Capture 12_23_34.png (83.59 KiB) Viewed 545 times
Last edited by pp4mnklinux on Mon Oct 21, 2024 10:24 am, edited 1 time in total.

PP4MNK

User avatar
amethyst
Posts: 2421
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 506 times

Re: Restart X Server

Post by amethyst »

pp4mnklinux wrote: Mon Oct 21, 2024 8:24 am

Sorry @amethyst but the zip has no files in it (it is empty), but no worries, It is enough with restart x server.

Thanks

It's definitely not empty. I've downloaded it and extracted the contents with uextract.

FeodorF
Posts: 245
Joined: Tue Jul 14, 2020 7:52 pm
Has thanked: 10 times
Been thanked: 35 times

Re: Script that restarts the X Server, reboots the computer?

Post by FeodorF »

Hi @pp4mnklinux
All you need to do is to click on the zip-file name to download it to your system.
As you save to /mnt/sda5 you need to make sure that you do have proper rights to that drive.

Restart-script.png
Restart-script.png (21.58 KiB) Viewed 418 times
Last edited by FeodorF on Thu Oct 24, 2024 10:13 am, edited 1 time in total.
User avatar
pp4mnklinux
Posts: 1141
Joined: Wed Aug 19, 2020 5:43 pm
Has thanked: 638 times
Been thanked: 289 times

Re: Script that restarts the X Server, reboots the computer?

Post by pp4mnklinux »

Thanks @FeodorF , now I have both files.

Have a nice day u all.- CHEERS.

Attachments
Capture 11_56_14.jpg
Capture 11_56_14.jpg (45.58 KiB) Viewed 413 times

PP4MNK

User avatar
pp4mnklinux
Posts: 1141
Joined: Wed Aug 19, 2020 5:43 pm
Has thanked: 638 times
Been thanked: 289 times

Re: Script that restarts the X Server, reboots the computer?

Post by pp4mnklinux »

@amethyst, excuseme, MY FAULT.

You were correct, you zip file has got the files inside, but this appears empty for me due to an error with my EasyOS'

Now I can see It contents, but as I told you, reboot system file doesn't work for me... sniff, sniff.

Sorry again, have a nice day

Attachments
Screenshot.jpg
Screenshot.jpg (169.15 KiB) Viewed 317 times

PP4MNK

Philh
Posts: 31
Joined: Sun Aug 16, 2020 1:50 pm
Been thanked: 7 times

Re: Script that restarts the X Server, reboots the computer?

Post by Philh »

Edit the script to use wmreboot which is what the menu uses.

User avatar
pp4mnklinux
Posts: 1141
Joined: Wed Aug 19, 2020 5:43 pm
Has thanked: 638 times
Been thanked: 289 times

Re: Script that restarts the X Server, reboots the computer?

Post by pp4mnklinux »

Thanks @Philh , this code works perfecty. @amethyst @Philh

Code: Select all

#thanks @Philh
#!/bin/sh
wmreboot #Reboot

I will include code for restartx too.-

Code: Select all

# Thanks  @amethyst
#!/bin/sh
restartwm #RestartX 

Now it's faster when working with EasyOS_daedalus (and scarthgap) haha

Thanks

scripts includes.- Delete fake extensión (that is delete .zip)

THANKS

My vote to include them in the next version.- @BarryK :))

Attachments
Screenshot(1).jpg
Screenshot(1).jpg (15.6 KiB) Viewed 280 times
RestartX.zip
(53 Bytes) Downloaded 122 times
Reboot.zip
(42 Bytes) Downloaded 122 times

PP4MNK

Post Reply

Return to “EasyOS”