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 command denied to user...

UDX创建用户时MySQL报以下错误:execute command denied to user 'se_conn'@'%s' for routine 'kyp_db.TL_GETSERIAL' 解...
  • wherwh
  • wherwh
  • 2011年03月30日 17:55
  • 11207

ERROR 1370 (42000): execute command denied to user backupAccount@'localhost' for routine 'databaseNa

调用存储过程时报了下面的错误 ERROR 1370 (42000): execute command denied to user backupAccount@'localhost' for rou...
  • white__cat
  • white__cat
  • 2015年05月08日 19:18
  • 2650

[Err] 1370 - execute command denied to user

问题描述: Mysql中UserA 调用UserB的函数时遇到 [Err] 1370 - execute command denied to user ‘test’@’’ for...
  • lwei_998
  • lwei_998
  • 2015年03月10日 17:03
  • 7781

tez0.6.0 编译报错

bower ESUDO         Cannot be run with sudo Additional error details: Since bower is a user co...
  • wisgood
  • wisgood
  • 2015年02月12日 15:12
  • 1464


85.You executed the following command to drop a user: DROP USER scott CASCADE; Which two statements ...
  • rlhua
  • rlhua
  • 2013年11月08日 00:13
  • 5588

1370 (42000): grant command denied to user ''@'localhost' for routine 'test.f1'

1370 (42000): grant command denied to user ''@'localhost' for routine 'test.f1'; 在调用自定义或者存储过程中遇到了er...
  • frozen_ice
  • frozen_ice
  • 2016年09月22日 09:47
  • 1554

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: SELECT command denied to user’

Linux环境 Mysql+Hibernate command denied to user 错误 错误信息 如下: com.mysql.jdbc.exceptions.jdbc4.MySQLSynt...
  • zhjw009
  • zhjw009
  • 2013年08月20日 17:17
  • 1865


  • weiwangsisoftstone
  • weiwangsisoftstone
  • 2014年09月14日 13:41
  • 48094


615.Before a Flashback Table operation, you execute the following command: ALTER TABLE employees ENA...
  • rlhua
  • rlhua
  • 2013年11月02日 01:12
  • 5234

Logon failure: user account restriction. Possible reasons are blank passwords not allowed, logon hour restrictions, or a policy

I'm trying to create a website on an Intranet, but when i try to log in the main page this message a...
  • bluebird7606
  • bluebird7606
  • 2011年04月29日 22:10
  • 1617
您举报文章:Execute a command on user logon