jhuckaby / Cronicle

A simple, distributed task scheduler and runner with a web based UI.
http://cronicle.net
Other
3.92k stars 391 forks source link

How run Cronicle Service as Spesific User ? #792

Open hasanbasri1993 opened 3 months ago

hasanbasri1993 commented 3 months ago

Summary

i got error when run as root, i need run as user: pi

Traceback (most recent call last):
  File "on.py", line 7, in <module>
    bus = smbus.SMBus(DEVICE_BUS)
IOError: [Errno 13] Permission denied
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2, and 3.
Version 0.3.2-1 (2012/03/25). Written and copyrights by Joe Drew,
now maintained by Nanakos Chrysostomos and others.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
tcgetattr(): Inappropriate ioctl for device
Title   : 15 Menit Sebelum Masuk         Artist : Moch Rizki                    
Album   : Bel Kbm                        Year    : 2021
Comment :                                Genre : Opera                         

Directory: /home/pi/media/kbm
Playing MPEG stream from 15menit_sebelum.mp3 ...
MPEG 1.0 layer III, 128 kbit/s, 48000 Hz joint-stereo
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM front
Can't find a suitable libao driver. (Is device in use?)
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2, and 3.
Version 0.3.2-1 (2012/03/25). Written and copyrights by Joe Drew,
now maintained by Nanakos Chrysostomos and others.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
tcgetattr(): Inappropriate ioctl for device

Directory: /home/pi/media
Playing MPEG stream from jaros_panjang.mp3 ...
MPEG 1.0 layer III, 256 kbit/s, 44100 Hz stereo
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM front
Can't find a suitable libao driver. (Is device in use?)
Traceback (most recent call last):
  File "off.py", line 7, in <module>
    bus = smbus.SMBus(DEVICE_BUS)
IOError: [Errno 13] Permission denied

Steps to reproduce the problem

Your Setup

Operating system and version?

Raspberry OS

Node.js version?

v16.7.0

Cronicle software version?

Version 0.9.59

Are you using a multi-server setup, or just a single server? single server

Are you using the filesystem as back-end storage, or S3/Couchbase? no

Can you reproduce the crash consistently?

When set npm run boot After restart will run service as root

I must stop using sudo Then start in user pi

Log Excerpts

waazaa-fr commented 3 weeks ago

You can install and use Cronicle as a user. All commands below must be launch as user:

mkdir ~/cronicle
cd ~/cronicle
wget https://github.com/jhuckaby/Cronicle/archive/refs/tags/v0.9.61.tar.gz
tar xf v0.9.61.tar.gz
cd Cronicle-0.9.61/
mv sample_conf/ conf

Edit the file conf/config.json for your needs.

Then continue commands:

npm install

When here you can start/stop Cronicle using the command:

/bin/sh /home/pi/cronicle/Cronicle-0.9.61/bin/control.sh start

If this command works you can add it into your crontab as @reboot:

crontab -e

# Add the line:
@reboot  /bin/sh /home/pi/cronicle/Cronicle-0.9.61/bin/control.sh start