DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 19th August 2023
stanl stanl is offline
Real Name: Stan
Package Pilot
 
Join Date: Jun 2019
Location: New York
Posts: 163
Default Running program as a daemon

I would appreciate it if someone could advise me how to set up a program to run as a daemon ; specifically the program redshift.

I read the rcctl man page and the daemon section in the OpenBSD handbook but all I get is: "service redshift does not exist".

Thank you
Reply With Quote
  #2   (View Single Post)  
Old 19th August 2023
jmccue jmccue is offline
Real Name: John McCue
Package Pilot
 
Join Date: Aug 2012
Location: here
Posts: 174
Default

I never heard of redshift, I looked it up, seems this adjusted your screen color in X. So running it via rcctl(1) probably will not work.

I would guess you kick it of from inside your ~/.xsession.
__________________
[t]csh(1) - "An elegant shell, for a more... civilized age."
- Paraphrasing Star Wars (tvtropes.org)
Reply With Quote
  #3   (View Single Post)  
Old 19th August 2023
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,001
Default

The rcctl(8) man page describes controlling daemons, which must be pre-established through daemon control scripts that have already been provisioned. In the SEE ALSO list of the rcctl(8) man page, you'll find the rc.d(8) man page, which describes using daemon control scripts, and its SEE ALSO refers to the rc.subr(8) man page, which describes in detail the routines required within those scripts.

If you're comfortable with shell scripting, you could write your own daemon control script for redshift.
Of course, redshift is designed to be started from your X session control script, rather than as a system daeom.

But, if the script ends up working well for you, you might consider adding it to the redshift port, from which the redshift package is built. And then, perhaps submitting your revision of the port to the ports@ mailing list for review and possible addition to the redshift port, for all users. Here's a link to the section in the Porter's Handbook on adding daemon control scripts to ports:http://www.openbsd.org/faq/ports/spe...html#RcScripts
Reply With Quote
  #4   (View Single Post)  
Old 20th August 2023
fvgit's Avatar
fvgit fvgit is offline
Spikes in tights
 
Join Date: May 2016
Location: perl -MMIME::Base64 -le 'print decode_base64("U2hlcndvb2QgRm9yZXN0")'
Posts: 314
Default

I have the snippet below in my ~/.xsession:
Code:
if [ -f /usr/local/bin/redshift ]; then
    redshift &
fi
Works very well.
Reply With Quote
  #5   (View Single Post)  
Old 20th August 2023
stanl stanl is offline
Real Name: Stan
Package Pilot
 
Join Date: Jun 2019
Location: New York
Posts: 163
Default

My thanks to jmccue, jggimi and fvgit for taking the time to reply.

Unfortunately, I know nothing about shell scripting so the chances of me writing a daemon control script for redshift are slim.

Finally, at the risk of wearing out my welcome, why fvgit's little snippet (which I have added to my ~/.xsession) and not simply:

/usr/local/bin/redshift &

in ~/.xsession?

Thank you
Reply With Quote
  #6   (View Single Post)  
Old 20th August 2023
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,139
Default

Maybe fvgit has multiple machines and only wants to use redshift on one of them.

By making the invocation of redshift conditional, he still can use one standard .xsession on all of them.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #7   (View Single Post)  
Old 21st August 2023
stanl stanl is offline
Real Name: Stan
Package Pilot
 
Join Date: Jun 2019
Location: New York
Posts: 163
Default

Thank you for the explanation. I hadn't considered the possibility of more than one machine.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenBSD VM running OpenVPN keeps running out of entropy (viornd driver) discostew OpenBSD Packages and Ports 6 4th June 2021 09:58 PM
Snort Daemon not running Peter_APIIT OpenBSD Packages and Ports 7 30th June 2015 12:32 PM
need help with pre-threaded TCP/IP daemon unixjingleman Programming 4 30th March 2013 08:01 PM
Best way to check if freebsd server is running a nameserver service/daemon Yuka FreeBSD General 7 6th November 2008 01:26 AM
dbus-daemon lumiwa FreeBSD General 2 2nd October 2008 12:05 AM


All times are GMT. The time now is 02:21 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick