LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions
User Name
Password
Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on... Note: An (*) indicates there is no official participation from that distribution here at LQ.

Notices


Reply
  Search this Thread
Old 04-21-2003, 09:09 AM   #1
=X¥®µ§=
LQ Newbie
 
Registered: Aug 2002
Distribution: Arch Linux
Posts: 26

Rep: Reputation: 15
debian - custom startup command


How can I execute a custom command when debian is booting - without having to create an init.d script?

I have a python script that I would like to run everytime the system boots (with the command /usr/bin/python spitman.py since running it standalone gives this error:

bash: /sbin/spitman: "/usr/bin/python: bad interpreter: Permission denied")

my own init.d script failed because of this

any ideas??
 
Old 04-22-2003, 07:18 PM   #2
abc249
Member
 
Registered: Apr 2003
Distribution: Mandrake 9,10, Xandros
Posts: 52

Rep: Reputation: 15
perhaps bash does not recognize the python scripting and thus will not excecute it. Can you run in bash?
 
Old 04-23-2003, 12:20 PM   #3
=X¥®µ§=
LQ Newbie
 
Registered: Aug 2002
Distribution: Arch Linux
Posts: 26

Original Poster
Rep: Reputation: 15
what do you mean with 'can you run in bash'??

can I run python in bash? yes (>python)
can I run the script in bash with python? yes (>python spitman.py)
can I run the script standalone? no (>./spitman.py with #!/usr/bin/python on top of the script)
 
Old 04-23-2003, 03:28 PM   #4
abc249
Member
 
Registered: Apr 2003
Distribution: Mandrake 9,10, Xandros
Posts: 52

Rep: Reputation: 15
then perhaps bash doesn't know to use python to interpret the file, you have to tell it to
I don't know anything else to say
sorry
 
Old 04-23-2003, 03:32 PM   #5
=X¥®µ§=
LQ Newbie
 
Registered: Aug 2002
Distribution: Arch Linux
Posts: 26

Original Poster
Rep: Reputation: 15
putting #!/usr/bin/python on top of the file should take care of that...
 
Old 04-25-2003, 08:31 AM   #6
Mork
Member
 
Registered: Mar 2003
Location: Visby, Sweden
Distribution: Ubuntu 4.10
Posts: 64

Rep: Reputation: 15
Have you checked permissions on the script. Having insufficient permissions would cause an error like this (been there, done that).
 
Old 04-25-2003, 10:59 AM   #7
=X¥®µ§=
LQ Newbie
 
Registered: Aug 2002
Distribution: Arch Linux
Posts: 26

Original Poster
Rep: Reputation: 15
[xirus@a1300 spitman]$ chmod 777 spitman.py
[xirus@a1300 spitman]$ ./spitman.py
bash: ./spitman.py: /usr/bin/python: bad interpreter: Permission denied

nope, it has nothing to do with permissions
 
Old 04-28-2003, 11:26 AM   #8
Artimus
Member
 
Registered: Feb 2003
Location: Wisconsin
Distribution: Slackware
Posts: 188

Rep: Reputation: 30
You really shouldn't chmod a startup script to 777. This means that anybody can modify this script.

If somebody gets in as a regular user, they could modify it to rm -rf / for example. Bad idea. Try chmod 770 thescripthere && chmod +x thescripthere.
 
Old 04-28-2003, 03:38 PM   #9
=X¥®µ§=
LQ Newbie
 
Registered: Aug 2002
Distribution: Arch Linux
Posts: 26

Original Poster
Rep: Reputation: 15
I know, but it was only a test to see if it had something to do with permissions - it didn't

but I finally did found out what it was: bash can't handle scripts that are stored on a fat32 (any OS/distro can read/write this in a stable way so that's where my personal folder is stored...)

after I copied that script to an ext3 partition, I got an init.d script working!
 
  


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
Usermin Custom Command help please AlphaNate Linux - Software 0 09-12-2005 08:16 AM
Adding Custom Services to Startup (FC3) SSTwinrova Fedora 1 08-11-2005 05:26 PM
Command at System Startup (Debian Sarge) sebgate20 Linux - Software 0 02-10-2005 04:50 PM
custom cd command glingon Linux - General 4 11-01-2004 07:39 PM
custom startup process: init.d, rc.d etc, mingetty Guru3 Linux - General 4 10-19-2003 11:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions

All times are GMT -5. The time now is 11:24 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