You are not logged in.
Pages: 1
Hi,
I have a script that I've developed and I want it to run when the machine boots up. I would use gnome-session-properties, but I want it to run even if I don't log in to the machine. An additional condition is, that it should run as user, not root. It's optional but there's no reason for it to run as root.
I've tried putting it up in /etc/rc.local like this:
kuba:~$ cat /etc/rc.local
#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
su -c "/home/kuba/devel/sabcommander/backend/backend.rb" - kuba &
And it actually spawns the processes:
kuba:~$ ps aux | grep sabcommander
root 648 0.0 0.0 27588 1096 ? S 21:21 0:00 su -c /home/kuba/devel/sabcommander/backend/backend.rb - kuba
kuba 1020 0.1 0.6 106452 26280 ? Sl 21:21 0:00 ruby /home/kuba/devel/sabcommander/backend/backend.rb
But they don't seem to work. This script connects via WebSockets to a remote server and keeps the connection, when it receives commands it executes few HTTP requests at localhost.
When I run a separate instance from the terminal, I then see that this script works, so I'm sure the one started from rc.local is not working.
Thanks
Last edited by farnoy (2012-05-08 06:26:13)
Offline
Everything that I put into /etc/rc.local works fine, so double check the script. Looks like your running ruby, so I can't help much with the script itself.
Also check to make sure that its not missing something like #!/bin/ruby
Last edited by stealthy (2012-05-05 20:22:19)
clipodder-git A small simple cron-friendly podcast downloader, with support for arbitrary user defined media types (pdf, html, etc...)
Offline
Judging by the ps aux output, the script should be executed.
Try letting the script do something simple you can check (something in the lines of touch on a file). If that works, something in your ruby script acts funky when called this way.
Maybe it needs something that isn't ready at the time it's started.
Just some vague ideas, because 1. there's very little information and 2. I have no clue concerning ruby
Offline
Offline
Thanks for replies,
I'm starting network like this:
DAEMONS=(syslog-ng dbus @net-profiles crond ...)
I'll rewrite my script to sleep for a few seconds at the beginning and then I'll post here.
Offline
Thanks for replies,
I'm starting network like this:
DAEMONS=(syslog-ng dbus @net-profiles crond ...)
I'll rewrite my script to sleep for a few seconds at the beginning and then I'll post here.
I think to start net-profiles in the background is not the best idea.
Offline
farnoy wrote:Thanks for replies,
I'm starting network like this:
DAEMONS=(syslog-ng dbus @net-profiles crond ...)
I'll rewrite my script to sleep for a few seconds at the beginning and then I'll post here.
I think to start net-profiles in the background is not the best idea.
It most definitely isn't, if a script depending on it is to be started during the boot process
I think that's the problem right there, remove the @ sign in front of network-profiles and try again.
Offline
Yup, it fixed the problem, so the network was unavailable at the time and the init script was fine.
I guess i ordered it to start in the background for faster boot times, but I don't think it gave me much anyway.
Thanks everyone.
Should i put [SOLVED] in the topic name? Is that how it's done here?
Offline
Just edit your first post and add it to the title.
Offline
Pages: 1