LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 10-08-2009, 08:55 AM   #1
Lieve
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
Run script after auto login on graphical system


Hi,

I was wondering if there is a way to run a script after the autologin (don't shoot me, I'll explain why) on a restart of a server.

The reason I'm asking this is that I need to execute a command to start a process on the server whenever the system is rebooted BUT this command can ONLY be run from a graphical interface..

If possible I'd like to prevent any "user-action" if the server was rebooted so any tips would be very much appreciated!

Thank you very much for your help!
Regards
 
Old 10-08-2009, 03:54 PM   #2
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 101Reputation: 101
Quote:
Originally Posted by Lieve View Post
Hi,

I was wondering if there is a way to run a script after the autologin (don't shoot me, I'll explain why) on a restart of a server.

The reason I'm asking this is that I need to execute a command to start a process on the server whenever the system is rebooted BUT this command can ONLY be run from a graphical interface..

If possible I'd like to prevent any "user-action" if the server was rebooted so any tips would be very much appreciated!

Thank you very much for your help!
Regards
Put the command in the autologin user's .bashrc configuration file. Commands in this file are executed as the last step in the login process.
 
Old 10-09-2009, 01:50 AM   #3
Lieve
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Isn't that going to make it execute whenever that user logs in? Because it has to be executed only once.. when the server is booted...

Or am I wrong here?
Thank you!
 
Old 10-09-2009, 02:09 AM   #4
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 101Reputation: 101
Quote:
Originally Posted by Lieve View Post
Isn't that going to make it execute whenever that user logs in? Because it has to be executed only once.. when the server is booted...

Or am I wrong here?
Thank you!
Well, I would have suggested putting a command in /etc/rc.local, except that you specified it must be run from a graphical environment.

In fact, here are the two requirements you have specified:

1. "it has to be executed only once.. when the server is booted ..."

2. "this command can ONLY be run from a graphical interface..."

You cannot have both. You must decide which one you want more, and abandon the other.

Quote:
Or am I wrong here?
It's not an issue of right and wrong, it's an issue of feasibility.
 
Old 10-09-2009, 05:57 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
Quote:
Originally Posted by lutusp View Post
Well, I would have suggested putting a command in /etc/rc.local, except that you specified it must be run from a graphical environment.

In fact, here are the two requirements you have specified:

1. "it has to be executed only once.. when the server is booted ..."

2. "this command can ONLY be run from a graphical interface..."

You cannot have both. You must decide which one you want more, and abandon the other.
What if boot was followed by auto-login? Then the program could be started using the Desktop session autostart facilities. A marker file, deleted during boot, could be used to ensure the program was only run once per boot, not every time the user starts a desktop session.

BTW, needing to do this is a ugly hole to have gotten into
 
Old 10-09-2009, 05:59 AM   #6
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 101Reputation: 101
Quote:
Originally Posted by catkin View Post
What if boot was followed by auto-login? Then the program could be started using the Desktop session autostart facilities. A marker file, deleted during boot, could be used to ensure the program was only run once per boot, not every time the user starts a desktop session.

BTW, needing to do this is a ugly hole to have gotten into
I had considered that arrangement, but I thought it might be a bit much for the OP. It would certainly work and meet both requirements.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write a script with auto login ssh and then run commands? keber314 Linux - Server 13 02-16-2009 04:37 PM
auto login + run programs ferradura Slackware 11 10-04-2006 05:11 AM
user cannot login to graphical-system womd Linux - Software 6 12-16-2005 06:27 AM
Graphical Auto-Login without using KDM or GDM soda Linux - General 7 12-01-2002 01:57 PM
halting system at graphical login reepark Linux - General 3 08-13-2002 06:31 PM


All times are GMT -5. The time now is 05:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration