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

bug: Unable to start the server without opening the terminal in Raspberry Pi, unable to set autostart on boot with crontab #301

Closed
3 tasks done
dhanuhammer opened this issue Apr 25, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@dhanuhammer
Copy link

Bug description

there seems to be no way this application works without giving the commnd after opening the terminal. There seems to be no way to start the server on boot. Crontab, supervisor nothing works.

Steps to reproduce

  1. using the correct syntax, checking the proper path and typing the command in the crontab, fails to load the application after a reboot.

Relevant log output

log output from supervisorctl

goroutine 1 [running]:
github.com/rabilrbl/jiotv_go/v3/pkg/store.GetPathPrefix()
        github.com/rabilrbl/jiotv_go/v3/pkg/store/store.go:110 +0x190
github.com/rabilrbl/jiotv_go/v3/pkg/utils.GetPathPrefix(...)
        github.com/rabilrbl/jiotv_go/v3/pkg/utils/utils.go:324
github.com/rabilrbl/jiotv_go/v3/cmd.init()
        github.com/rabilrbl/jiotv_go/v3/cmd/background.go:15 +0x1c
panic: GetPathPrefix: error getting user home directory: $HOME is not defined

Screenshots or videos

No response

Solution

No response

Additional context

No response

Acknowledgements

  • I have searched the existing issues and this is a new and no duplicate or related to another open issue.
  • I have written a short but informative title.
  • I filled out all of the requested information in this issue properly.
@dhanuhammer dhanuhammer added the bug Something isn't working label Apr 25, 2024
@rabilrbl
Copy link
Owner

Please post your crontab / supervisor configuration scripts and tell us steps you taken to perform this.

@dhanuhammer
Copy link
Author

dhanuhammer commented Apr 27, 2024

crontab: @reboot /home/pi/.jiotv_go/bin/jiotv_go background run -a "--public"

supervisorctl: [program:jiotv]
command=/home/pi/.jiotv_go/bin/jiotv_go background run -a "--public --config /h>
directory=/home/pi/.jiotv_go/bin/
user=pi
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/jiotv.log

I tried using crontab as pi user, root user but still jiotvgo does not start on reboot.

I reboot the Pi everyday at midnight and everything works properly except for this script.

@rabilrbl
Copy link
Owner

crontab: @reboot /home/pi/.jiotv_go/bin/jiotv_go background run -a "--public"

supervisorctl: [program:jiotv]
command=/home/pi/.jiotv_go/bin/jiotv_go background run -a "--public --config /h>
directory=/home/pi/.jiotv_go/bin/
user=pi
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/jiotv.log

I tried using crontab as pi user, root user but still jiotvgo does not start on reboot.

I reboot the Pi everyday at midnight and everything works properly except for this script.

In your crontab script
Can u please set the environment variable HOME=/home/pi and check

@dhanuhammer
Copy link
Author

@reboot HOME= /home/pi /home/pi/.jiotv_go/bin/jiotv_go background run -a "--public"
this is how I edited the crontab line, but still jiotvgo does not start after reboot.
The script was started in the background before I rebooted the pi

@rabilrbl
Copy link
Owner

@reboot HOME= /home/pi /home/pi/.jiotv_go/bin/jiotv_go background run -a "--public"
this is how I edited the crontab line, but still jiotvgo does not start after reboot.
The script was started in the background before I rebooted the pi

Remove space after =
HOME=/home/pi

@dhanuhammer
Copy link
Author

dhanuhammer commented Apr 27, 2024 via email

@dhanuhammer
Copy link
Author

hello
the crontab script worked for 2 days but then it stopped again.
even your docker container does not have option for --restart=always.
crontab works well for other commands. the syntax is also exactly as per your instructions.
what is the solution?

@rabilrbl
Copy link
Owner

rabilrbl commented May 5, 2024

For those facing issues with Pi autostart, you need to set the full path. This worked for me:

sudo crontab -e

@reboot /root/.jiotv_go/bin/jiotv_go bg run --args "--host 0.0.0.0 --port 5001"

Try with root user

Thanks @sloBlocks for the hint !

@dhanuhammer
Copy link
Author

the above solution did not work.
As per the latest update, I followed the guide to create an user, usergroup and daemon to autostart.
the script worked for 3 days, but it stopped working today.

this was the output i got after giving sudo systemctl status jiotv_go:

● jiotv_go.service - JioTV Go Client Daemon
Loaded: loaded (/etc/systemd/system/jiotv_go.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/jiotv_go.service.d
└─user.conf
Active: failed (Result: exit-code) since Tue 2024-05-14 03:35:27 IST; 14h ago
Process: 741 ExecStart=/home/pi/.jiotv_go/bin/jiotv_go serve -P (code=exited, status=1/FAILURE)
Main PID: 741 (code=exited, status=1/FAILURE)
CPU: 23ms

May 14 03:35:27 raspberrypi systemd[1]: jiotv_go.service: Failed with result 'exit-code'.
May 14 03:35:27 raspberrypi systemd[1]: jiotv_go.service: Scheduled restart job, restart counter is at 5.
May 14 03:35:27 raspberrypi systemd[1]: Stopped JioTV Go Client Daemon.
May 14 03:35:27 raspberrypi systemd[1]: jiotv_go.service: Start request repeated too quickly.
May 14 03:35:27 raspberrypi systemd[1]: jiotv_go.service: Failed with result 'exit-code'.
May 14 03:35:27 raspberrypi systemd[1]: Failed to start JioTV Go Client Daemon.

@rabilrbl
Copy link
Owner

@dhanuhammer The error is because of JioTV Go Bug in Auth service.
This thread shall be closed and another one should be opened with your logs, right when u experienced crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants