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 12th January 2014
Biased Biased is offline
New User
 
Join Date: Jan 2014
Posts: 6
Default Issues with rc.local file (and getting CUPS to start at boot time)

Hi all,
1st post so go easy!

I've been putting together an OpenBSD 5.4 virtual, on Virtual box, with Ubuntu 12.04LTS as host OS. It's up and running, and CUPS is installed and can be started manually, but I can't seem to get the rc.local file organised, so that CUPS starts on boot. Whatever I try, I cop a syntax error suggesting an un-closed quote at line (x).

Current rc.local is as below:
Code:
#	$OpenBSD: rc.local,v 1.44 2011/04/22 06:08:14 ajacoutot Exp $

# Site-specific startup actions, daemons, and other things which
# can be done AFTER your system goes into securemode.  For actions
# which should be done BEFORE your system has gone into securemode
# please see /etc/rc.securelevel.

echo -n 'Staring local Daemons:'

#Add local startup actions here.

#if [ -x /usr/local/bin/dbus-daemon ]; then
#	mkdir -p /var/run/dbus
#	chmod 0755 /var/run/dbus
#	chown -R messagebus:messagebus /var/run/dbus --system

#	/usr/local/bin/dbus-daemon
#fi

if [ -x /usr/local/libexec/smbd ]; then
	echo -n ' smbd'
	/usr/local/libexec/smbd
fi

if [ -x /usr/local/libexec/nmbd ]; then
	echo -n ' nmbd'
	/usr/local/libexec/nmbd 
fi

if [ -x /usr/local/sbin/cupsd ]; then
	echo -n ' cupsd';	/usr/local/sbin/cupsd
fi

#if [ -x /usr/local/sbin/snmpd ]; then
#	echo -n ' snmpd';	/usr/local/sbin/snmpd
#fi

kdm_flags=""
if [ "X${kdm_flags} != X"NO" ] then
  /usr/local/bi/kdm ${kdm_flags} ;
echo -n 'kdm '
fi

echo '.'
Whatever I try at the end, I get the same error. Obviously I'm missing something basic, so can someone point it out to me? Thanks in advance.

Last edited by ocicat; 12th January 2014 at 04:09 AM. Reason: Please use [code] & [/code] tags when posting file contents.
Reply With Quote
  #2   (View Single Post)  
Old 12th January 2014
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Quote:
Originally Posted by Biased View Post
Whatever I try at the end, I get the same error. Obviously I'm missing something basic, so can someone point it out to me? Thanks in advance.
Welcome!

Per Section 4.14 of the FAQ, the contents of /etc/rc.conf should not be modified. Customizations should go into /etc/rc.conf.local. Following this practice will also make updating simpler as the upgrade process will replace /etc/rc.conf, but leave /etc/rc.conf.local unaltered.

Further information can be found in the rc.conf(8) manpage.
Reply With Quote
  #3   (View Single Post)  
Old 12th January 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

Hello, and welcome!

Whatever guide you have been following that sent you to rc.local is at least three years out-of-date. Starting with OpenBSD 4.9, the OS deployed an rc.d infrastructure and all built-in and third party (ports/packages) daemons use it. You can look through the complete list of rc.d scripts, both built-in and installed through packages (dbus, cups, and the like) as they are all located in the /etc/rc.d directory.

You turn them on and off by setting variables in your /etc/rc.conf.local file. Built-in daemons are enabled by setting their individual <daemon>_flag variables, and third party daemons are added to a space separated pkg_scripts variable. To start both dbus and cups, you might have this line within rc.conf.local:
Code:
pkg_scripts="dbus_daemon cupsd"
For more info, see these man pages:afterboot(8), rc.conf(8), rc.d(8), and OpenBSD FAQ 10.3. The FAQ is the only official how-to document, and unlike whatever you were using, it is kept up to date with the most recent release.

The rc.conf infrastructure is also briefly described in the Email to the new root account that is part of the standard installation.
Reply With Quote
  #4   (View Single Post)  
Old 12th January 2014
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

Just to tidy up the mystery error in the obsolete rc.local approach, it seems it's indeed an unclosed quote, along with a missing semi-colon

Code:
if [ "X${kdm_flags}" != X"NO" ]; then
ForWhatIt'sWorth
Reply With Quote
  #5   (View Single Post)  
Old 12th January 2014
Biased Biased is offline
New User
 
Join Date: Jan 2014
Posts: 6
Default

Quote:
Originally Posted by IdOp View Post
Just to tidy up the mystery error in the obsolete rc.local approach, it seems it's indeed an unclosed quote, along with a missing semi-colon

Code:
if [ "X${kdm_flags}" != X"NO" ]; then
ForWhatIt'sWorth
Thanks for the replies; have amended the rc.conf.local file to load the cups daemon. Tries to load at start up, but still gives me the "unclosed quotes" error...reading the above post, I can now see why. Will amend the rc.local file later and see if that helps. Thanks again for your help!
Reply With Quote
  #6   (View Single Post)  
Old 13th January 2014
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

Quote:
Originally Posted by Biased View Post
Thanks for the replies; have amended the rc.conf.local file to load the cups daemon. Tries to load at start up, but still gives me the "unclosed quotes" error...reading the above post, I can now see why. Will amend the rc.local file later and see if that helps. Thanks again for your help!
You didn't say how you amended the rc.conf.local file, but reading between the lines it sounds like you added the material you had put in rc.local to it. If that's what you've done, it would explain why you still got the same error, and more to the point it wasn't the right approach for using rc.conf.local. Please take another, careful, look at jggimi's post because it contains a lot of good info to get you going in the right direction.
Reply With Quote
  #7   (View Single Post)  
Old 13th January 2014
Biased Biased is offline
New User
 
Join Date: Jan 2014
Posts: 6
Default

Quote:
Originally Posted by IdOp View Post
You didn't say how you amended the rc.conf.local file, but reading between the lines it sounds like you added the material you had put in rc.local to it. If that's what you've done, it would explain why you still got the same error, and more to the point it wasn't the right approach for using rc.conf.local. Please take another, careful, look at jggimi's post because it contains a lot of good info to get you going in the right direction.
Thanks, all good. I used the same syntax as jggimi posted, and added cupsd in there...just about to close off the quote and add the semi-colon into the rclocal file (per your earlier suggestion), and hopefully all will be good.
Reply With Quote
  #8   (View Single Post)  
Old 13th January 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

It's not clear if you are still using rc.local for starting daemons, including kdm. If so, this is no longer a best practice.The pkg_script variable is used not only for start up, but for orderly shutdown, and the individual scripts may be used by the admin to stop or restart daemons manually.
Reply With Quote
Reply

Thread Tools
Display Modes

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
Start only connected Nic at boot tolstoi NetBSD General 4 19th January 2012 01:49 AM
Cannot start program in rc.local guitarscn OpenBSD General 2 8th November 2010 01:10 PM
Weird time issues schrodinger OpenBSD General 7 26th October 2009 03:20 PM
firefox/thunderbird take very long time (~45s) to start caesius FreeBSD Ports and Packages 4 28th November 2008 12:04 AM
ATH not loaded during boot time?? disappearedng FreeBSD General 4 14th July 2008 06:57 AM


All times are GMT. The time now is 10:06 AM.


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