11.10 and above
gnome-session-quit
11.04 and previous versions
dbus-send --session --type=method_call --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.Logout uint32:1
(via DoR, see his answer to "Reboot without sudoer privileges?" for more dbus goodness!)
or alternatively, you can use
gnome-session-save --force-logout
--force-logout
in contrast to just --logout
will not ask the user to deal with unsaved documents and so on.
is this the easiest way? no simple one
line command like sudo logout?? I will
never remember all that.
Yes, there is a command called logout, but it concerns the Terminal. gnome-session-save is the program that actually quits the gnome-session
, which you can of course kill, but that wouldn't qualify as logging out. :-)
Notice as well that these commands don't require you to be root.
You can always add an alias to your system if you want to have a shorter command.
Open ~/.bash_aliases
with a text editor, or create it if it isn't there, and add something like this to it:
alias logout-gnome="gnome-session-save --force-logout"
(.bashrc is a script that is run every time a new virtual terminal is started up, you should set up all your permanent aliases there, see also: How to create a permanent "alias"?)
In the file manager, go to /usr/share/applications
. Open it with root access (Tools -> Open Current Folder as Root)
In your root access file manager window, create a new file (File -> Create New -> Blank File)
Name the new file touchpad.desktop.
Find your newly created file, right-click it, edit it with leafpad.
In leafpad, paste the following:
[Desktop Entry]
Name=Touchpad Autostart
Exec=/home/magpie/touchpad_settings.sh
Type=Application
Terminal=false
Save it. If you can't save it, you are not in the window with root access. Start over again and follow the directions really carefully.
Again, find your file in the root access file manager window. Right-click and copy.
Now navigate your root window to the autostart folder:
/etc/xdg/autostart/
Finally, paste in your desktop file you created earlier.
If you did everything correctly, you should see a lot of other autostart files, but you will also see the file, "Touchpad Autostart"
This is not the fastest way to do things, but you seemed to be struggling with a lot of steps in the other answers, so I wanted to take it slow with a lot of details. If your script is still not running after rebooting (do not simply logout and back in), it's a problem with your script. Maybe double check?
Best Answer
Here's a easy way to do that using SysVInit. Instructions:
Create the start and the stop script of your application. Put it on some directory, in our example is:
/usr/local/bin/myapp-start.sh
/usr/local/bin/myapp-stop.sh
Each one will provide the instructions to run/stop the app. For instance the
myapp-start.sh
content can be as simple as the following:For the stop script it can be something like this:
Create the following script (
myscript
) and put it on/etc/init.d
./etc/init.d/myscript
content:Put the script to start with the system (using SysV). Just run the following command (as root):
PS: I know that Upstart is great and bla bla, but I preffer the old SysV init system.