Execute a command on user logon

转载 2016年08月30日 09:21:50

There is no guarantee that the graphical display manager will read the classic startup files. This changes between distributions and between display managers. One of the following should work though.

  1. Use your desktop environment's native method to set startup applications. The details will depend on the DE you are using, but you can create a script that runs your command and add it to the list of startup applications. For example, on my system (Cinnamon), you can do this through "System Settings" => "Startup Applications".

  2. Use ~/.xprofilethis is sourced by at least the GDM, LDM, LightDM and LXDM login managers.

  3. If neither of the above work, try adding the command to ~/.profile : This is the main initialization file for login shells and is also read by some graphical shells on login.

  4. As @derobert pointed out in the comments, you can also use the free desktop standards:

    The Autostart Directories are $XDG_CONFIG_DIRS/autostart as defined in accordance with the "Referencing this specification" section in the "desktop base directory specification".

    If the same filename is located under multiple Autostart Directories only the file under the most important directory should be used.

    Example: If $XDG_CONFIG_HOME is not set the Autostart Directory in the user's home directory is ~/.config/autostart/

    Example: If $XDG_CONFIG_DIRS is not set the system wide Autostart Directory is /etc/xdg/autostart/

    Example: If $XDG_CONFIG_HOME and $XDG_CONFIG_DIRS are not set and the two files /etc/xdg/autostart/foo.desktop and ~/.config/autostart/foo.desktop exist then only the file ~/.config/autostart/foo.desktop will be used because ~/.config/autostart/ is more important than /etc/xdg/autostart/

The ~/.bashrc is completely irrelevant here, it is only read by interactive non-login shells, so is ignored on login shells, graphical or not.

相关文章推荐

Execute history command on Linux

1. Display timestamp using HISTTIMEFORMATTypically when you type history from command line, it displ...

User client windows logon basic data

在新增/刪除/修改資料時,常需要log使用者的基本資料,但使用者的IP Address、Windows帳號及電腦名稱在syst中又找不到。...

PL/SQL Developer Logon the DB user with ORA-12154

Logon the DB user with ORA-12154

使用JCIFS上传文件至NAS设备(Logon failure: unknown user name or bad password)解决

使用JCIFS上传文件至NAS设备(NETAPP FAS3140) 知识点: 1、安全认证方式   http://www.cnblogs.com/artech/archive/2011/01/2...

Create AD User, User must change password at next logon

Create AD User, User must change password at next logon /// /// /// /// "OU=myOU,OU=CMM...

eclipse不能debug的解决方法,提示Failed to execute MI command: maintenance set python print-stack off

提示: Error in final launch sequence Failed to execute MI command: maintenance set python print-stack ...

【2017/4/13】 Could not execute auto check for display colors using command /usr/bin/xdpyinfo.

解决Could not execute auto check for display colors using command /usr/bin/xdpyinfo.

Java Execute Command

OverView 在编写Java应用程序的过程中,偶尔需要调用一些Windows应用程序或者是一些命令,或者是需要批量执行一些现有的应用程序,这个时候可以选择使用Java的Runtime去执行。本文...

ccah-500 第49题 What occurs when you execute the command: hdfs haadmin -failover nn01 nn02

49.Your cluster implements HDFS High Availability (HA). Your two NameNodes are named nn01 and nn02. ...

How to Execute a Command in C# ?

http://www.codeproject.com/Articles/25983/How-to-Execute-a-Command-in-C This article will help ...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Execute a command on user logon
举报原因:
原因补充:

(最多只允许输入30个字)