trying to launch obexpushd at boot with rc.local or crontab but not working. pls help
When I use terminal everything works. This is my command:
sudo obexpushd -B -n -o '/home/pi/files' OR sudo obexpushd -B -o '/home/pi/files' How can I get this to start at boot? I tried editing rc.local and adding this line: ------------------------- sudo obexpushd -B -o '/home/pi/files' & exit 0 ------------------------- And with no success. I cant figure out why! I even found a tutorial that follows the same steps and works https://hackaday.io/project/3917-pi-...oth-adventure# pls help im really frustrated been doing this for a couple of days |
You should put a script into your /etc/init.d directory.
Note other scripts in there, such as S02Modules or something similar. You can make an executable script S##<name> where the ## is a number from 01-99. Suggest you use a higher number. They go in order from 01-99 as the system boots. A common mistake is that someone fails to make the script file executable, or the scripts are owned by a user as opposed to being owned by root. You will not need sudo because the init script will run as root. You should continue to use the & at the end of your command, this will have the command run in the background, or as a non-blocking script when the system boots. The script can be as simple as: Code:
obexpushd -B -o '/home/pi/files' & |
In addition, it depends on what distribution/version your running on the Pi. The latest version of raspian is based upon Jessie so it will use systemd versus sysv init.
If using a systemd distribution I assume you need to enable the rc-local service as well as change the rc.local permissions for execution just like a regular OS. I assume that the rc-local service already exists. sudo systemctl enable rc-local sudo chmod +x /etc/rc.local |
Unfortunately, I still can't get things working. What works is making a script in init.d, using chmod and update-rc to give permissions and register the .sh file to run at boot.
I know myfile.sh has root access, and I can run the file manually, but it doesn't run at boot. And don't I need #! /bin/sh at the start of a init.d file to get it to work at boot? I would most appreciate it if sbd could answer with the full code I need to insert into /etc/init.d/my file.sh as I think that's where my problem lies. Otherwise, if anyone could help me on discord @audekx#9305 I promise to post what helped me back on the forum! Thx in advance |
Quote:
instead, you should make an effort to answer all the questions asked and suggestions made so far. my own take: - surely something must be in the logs if it fails - 'command & exit' might fail. probably best to remove the 'exit 0' - anyhow show us the complete script |
All times are GMT -5. The time now is 12:33 AM. |