LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 07-17-2008, 10:44 PM   #1
mpmackenna
Member
 
Registered: May 2006
Posts: 69

Rep: Reputation: 15
Python app to run on KDE startup


I am trying to get gmail notifier to run at startup. I went to my /home/mike/.kde/autostart folder and created a new test file called notifier.py. Then in that file I typed the following lines.
Code:
#!/usr/bin/env python
/usr/share/gmail-notify/notifier.py
When I login instead of the script running it just opens the text file. I googled for the answer to this undeniably simple question, but so far I can't find it. Would someone please point me in the direction? Thanks so much for any assistance.
Mike
Note: I am running Mandriva Linux 2008.1 with KDE. Thanks!
Oh, one more thing, is /usr/share an appropriate place to put the gmail-notify folder? I don't know I am a newb.

Last edited by mpmackenna; 07-17-2008 at 10:46 PM.
 
Old 07-18-2008, 12:09 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Is notifier.py executable? Just because it's a python script doesn't make it executable. You have to set the executable bit: as root,
chmod u+x /usr/share/gmail-notify/notifier.py
 
Old 07-18-2008, 12:23 AM   #3
mpmackenna
Member
 
Registered: May 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bigrigdriver View Post
Is notifier.py executable? Just because it's a python script doesn't make it executable. You have to set the executable bit: as root,
chmod u+x /usr/share/gmail-notify/notifier.py
Still no dice... I think it was set as executable already. User mike has rwx rights to begin with and I ran that command as well. Still cant double click on my notifier.py shortcut and have the program launch.
Thanks for the response.
 
Old 07-18-2008, 12:22 PM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
The safe way : make a script (in e.g. /usr/local/bin)
and make the "script.sh" an entry in Autostart.
Quote:
#! /bin/sh
cd /usr/share/gmail-notify/
exec python notifier.py
Regards
 
Old 07-18-2008, 12:31 PM   #5
mpmackenna
Member
 
Registered: May 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by knudfl View Post
The safe way : make a script (in e.g. /usr/local/bin)
and make the "script.sh" an entry in Autostart.

Regards
Same issue, I put a text file named notify.sh in ~/.kde/Autostart/ and when I login it just opens KWrite with the text of the script instead of running the commands.
I used your script with the following statements.
Code:
#!/bin/sh
cd /usr/share/gmail-notify/
exec python notifier.py
Thanks for responding.
 
Old 07-18-2008, 05:30 PM   #6
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
In my experience stuff in ~/.kde/Autostart has to be a .desktop entry. You can just stick scripts in to ~/.kde/shutdown though which strikes me as rather inconsistent, but there you go.

Anyway, try this: In ~/.kde/Autostart make a file called gmailnotifyer.desktop that contains the following:

Code:
[Desktop Entry]
Type=Application
Name=GMailNotifier
Exec=python /usr/share/gmail-notify/notifier.py
 
Old 07-18-2008, 08:22 PM   #7
mpmackenna
Member
 
Registered: May 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by arizonagroovejet View Post
In my experience stuff in ~/.kde/Autostart has to be a .desktop entry. You can just stick scripts in to ~/.kde/shutdown though which strikes me as rather inconsistent, but there you go.

Anyway, try this: In ~/.kde/Autostart make a file called gmailnotifyer.desktop that contains the following:

Code:
[Desktop Entry]
Type=Application
Name=GMailNotifier
Exec=python /usr/share/gmail-notify/notifier.py
That worked! Thanks so much for the help.
 
Old 07-18-2008, 08:30 PM   #8
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
I think the problem with your script was your shebang was wrong.

You had it like this:

#!/usr/bin/env python

which has you invoking the env command. You should have had this:

$!/usr/bin/python

then your script would work.
 
Old 07-18-2008, 08:56 PM   #9
mpmackenna
Member
 
Registered: May 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jiml8 View Post
I think the problem with your script was your shebang was wrong.

You had it like this:

#!/usr/bin/env python

which has you invoking the env command. You should have had this:

$!/usr/bin/python

then your script would work.
I tried your suggestion just to see if it would help. It still didn't work.

The only thing that has been successful so far is the suggestion made by Arizonagroovejet.

Thanks for the response.
 
Old 07-18-2008, 09:00 PM   #10
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Well, I did have a typo.

I put in $!/usr/bin/python, which should have been #!/usr/bin/python

I run some bash scripts in my autostart; I do not think it HAS to be a .desktop file.
 
Old 07-18-2008, 09:03 PM   #11
mpmackenna
Member
 
Registered: May 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jiml8 View Post
Well, I did have a typo.

I put in $!/usr/bin/python, which should have been #!/usr/bin/python

I run some bash scripts in my autostart; I do not think it HAS to be a .desktop file.
Yeah I caught your typo and corrected it for the test. It seems odd to me too that it would need to be a .desktop file, but that is the only thing that seems to be working for me at the moment. Thanks.
 
Old 07-19-2008, 06:00 AM   #12
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Sorry, I didn't express the issue clearly.
Suggest : script in /usr/local/bin/"script"
..and a link (or Desktop entry) in Autostart :
http://gentoo-wiki.com/HOWTO_Autostart_Programs

Regards
 
Old 04-08-2019, 04:10 PM   #13
vlxvbaxeqoff
LQ Newbie
 
Registered: Apr 2019
Posts: 2

Rep: Reputation: Disabled
AD 2019

Time has passed. On Kde5 one can do:
Start -> Search: autostart
In the 'Script File' section click on 'Add Script...' -> 'Shell script path:' -> OK -> 'Run On': default is 'Startup'.
That's it.
 
Old 04-08-2019, 04:11 PM   #14
vlxvbaxeqoff
LQ Newbie
 
Registered: Apr 2019
Posts: 2

Rep: Reputation: Disabled
Since that was my first post and wasn't allowed to fill in external links, I provide it below:

More documentation at:
https://docs.kde.org/trunk5/en/kde-w...art/index.html
 
  


Reply



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 auto run app on startup? babag Mandriva 2 05-08-2008 11:40 PM
Run Python script as root at startup StuL Linux - General 2 03-05-2008 05:33 PM
Run app on fluxbox workspace 2 at startup mokele Slackware 6 08-23-2006 10:40 PM
KDE Software Issue (Crashed on every KDE app startup) mehmety@gmail.com Linux - Software 1 05-22-2006 11:56 AM
RH 8.0, run app on startup? rivethead Linux - Software 1 02-04-2003 01:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 06:44 AM.

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
Open Source Consulting | Domain Registration