Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forever Service problem #593

Closed
brilvio opened this issue Sep 3, 2014 · 2 comments
Closed

Forever Service problem #593

brilvio opened this issue Sep 3, 2014 · 2 comments

Comments

@brilvio
Copy link

brilvio commented Sep 3, 2014

I have this bash:
/home/root/script.sh

!/bin/sh

DATA=date +%Y-%m-%d-%H-%M-%S

/usr/bin/forever start -e /home/root/xptcv/log/errorPower-$DATA.log -o /home/root/xptcv/log/infoPower-$DATA.log --sourceDir /home/root/xptcv/ power.js
sleep 1
/usr/bin/forever start -e /home/root/xptcv/log/errorCarregador-$DATA.log -o /home/root/xptcv/log/infoCarregador-$DATA.log --sourceDir /home/root/xptcv/ carregador.js
sleep 1
/usr/bin/forever start -e /home/root/xptcv/log/errorBico-$DATA.log -o /home/root/xptcv/log/infoBico-$DATA.log --sourceDir /home/root/xptcv/ bico.js
sleep 2
/usr/bin/forever start -e /home/root/xptcv/log/errorServer-$DATA.log -o /home/root/xptcv/log/infoServer-$DATA.log --sourceDir /home/root/xptcv/ server.js

Works fine with ./script.sh or sh /home/root/script.sh

When another script calls this script with the service, systemclt start Boot.service,
Forever seems lost he try to make the logs in /root/.forever instead of /home/root/.forever and try to bind to /root/.forever/pids instead of /home/root/.forever/pids. So I created this directories but now my script which works fine, accuse this problem:

Error: Cannot find module 'bonescript'

I think it is something to do with the Path, but I tried -p, --sourcedir and it is the same thing.
The problem only happen when the script is call from a service.

/lib/systemd/system/Boot.service

[Unit]
Description=Boot
After=syslog.target network.target

[Service]
Type=simple
ExecStart=/home/root/boot.sh

[Install]
WantedBy=multi-user.target

/home/root/boot.sh

!/bin/bash

DATA=date +%Y-%m-%d-%H-%M-%S
while [ ! -d "/media/BACKUP/backup" ]
do
sleep 1
done
tar -zcvf /media/BACKUP/backup/logs_bkp-$DATA.tar.gz /var/lib/cloud9/attic/xptcv/log/.log
sleep 1
rm /var/lib/cloud9/attic/xptcv/log/
.log
tar -zcvf /media/BACKUP/backup/bds_bkp-$DATA.tar.gz /var/lib/cloud9/autorun/*.db
sleep 1
sh /home/root/script.sh

If I execute the boot.sh I have no problem.

@brilvio
Copy link
Author

brilvio commented Sep 8, 2014

This problem occurs with service and crontab @reboot and with Angstrom on Beaglebone and Debian on Beaglebone, anyone knows how to solve this problem?

@indexzero
Copy link
Member

Pretty sure this has to do with the user your service script is running as. Related to #544.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants