A Light Display Manager (service) check and control script for Debian based Linux distributions (like Raspbian, not sure if it will run on any other Linux distributions, this is script is tested on Raspbian only)
Well, it checks if the lightdm service (often used by X server to control if the X server is up or not (also means if the desktop is running or not in Linux or *nix)) is running or not, if it's up then just stop the service and vice versa
The progra... No, I mean the "script" will check for a process called "lightdm", if it's running that means the "lightdm" service is running and vice versa, if the process is not runnning, the script will think that the service isn't runnning. It will use the "service" command to control the service.
Emmm... I don't know if it should be called simple or not but here we go:
- Login to your shell (and make sure the user that you use can use sudo command)
- Download the "desktop" file from my repository
you can achieve it by using the following command:
wget https://raw.githubusercontent.com/thebuster0/LightDM-service-check-control/master/desktop
- Change the file permission
chmod 777 desktop
Note: you can use whatever permission you want, but make sure it has the "Execute" permission, if not, the program will not run or cannot be recognized
- Move it to /bin/
sudo mv desktop /bin/
- Done
By default, the script should be runned without any parameters or it will return an "Unknown parameter error".
desktop
By running the script, the script will check if the service "lightdm" is running (or not), if it finds out that the service is running, it will stop it, if it isn't running, it will start the service.
The program should output something like this:
pervertAdministrator@qt0-ayumi:~ $ desktop ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === Authentication is required to start 'lightdm.service'. Multiple identities can be used for authentication: 1. ,,, (pervertAdministrator) 2. root Choose identity to authenticate as (1-2): 1 Password: ==== AUTHENTICATION COMPLETE === Light Display Manager is now running, desktop/VNC is available
or if you run it with sudo or using the root account it should output something like this
Light Display Manager is now running, desktop/VNC is available
another possible output is
without using sudo, runned as a normal user
pervertAdministrator@qt0-ayumi:~ $ desktop ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === Authentication is required to stop 'lightdm.service'. Multiple identities can be used for authentication: 1. ,,, (pervertAdministrator) 2. root Choose identity to authenticate as (1-2): 1 Password: ==== AUTHENTICATION COMPLETE === Light Display Manager is now stopped, desktop/VNC is unavailable
or, using sudo or root:
Light Display Manager is now stopped, desktop/VNC is unavailable
When using the "-s" parameter, the program will just output the current service status and exit. It won't need root permission (I think...). The following output will be the same if you use the root permission or not.
pervertAdministrator@qt0-ayumi:~ $ desktop -s Light Display Manager is now stopped, desktop/VNC is unavailable
Yes, there is a help guide built into the script. To access it you can use 3 different commands:
desktop --help
desktop -h
desktop -?
It will print the parameters and it will exit directly
(No parameters): Check if the Light Display Manager service is running or not, if the service is running, stop the service (and print the status) and vice versa -s: Print the status of the service Light Display Manager and exit --help: Display this info/help and exit -h: Display this info/help and exit -?: Display this info/help and exit
But you cannot combine "-h" with "--help" or "-?" or anything else like "desktop -h --help", it will result an "Unknown parameter error".
Same thing with "desktop -s -h", you cannot combine the "-s" parameter (also known as a "status" parameter) with any help parameter.
See the LICENSE file. This repository is under the public domain, you can do whatever you want.