[cups] lpadmin in a startup script

Louis Garcia louisgtwo at gmail.com
Sun Sep 9 19:03:45 PDT 2018


I found the issue. Selinux was preventing the file to run. I changed
rc.local from etc_t to initrc_exec_t and all is well.

On Sun, Sep 9, 2018 at 8:32 PM Louis Garcia <louisgtwo at gmail.com> wrote:

> I think rc.local is the last script run at boot. I did not want to mess
> with a systemd service for something so minimal, but I'll take a look.
>
> On Sun, Sep 9, 2018 at 8:23 PM Michael Sweet <msweet at apple.com> wrote:
>
>> Louis,
>>
>> cupsd might not yet be started...  Generally speaking, you need to make
>> sure that your startup script is run after the other system services are
>> started.  Fedora uses systemd so you'll probably want to setup something
>> with systemd to run your script after starting cupsd...
>>
>>
>> > On Sep 9, 2018, at 8:05 PM, Louis Garcia <louisgtwo at gmail.com> wrote:
>> >
>> > I would like to add a printer at system startup if one is not present.
>> This
>> > is on fedora
>> >
>> > I created /etc/rc.d/rc.local and made the file executable
>> >
>> > if [ ! -f "/etc/cups/ppd/Officejet-6700.ppd" ]; then
>> >  /sbin/lpadmin -p Officejet-6700 -o printer-is-shared=false -L "Office"
>> -E
>> > -v hp:/net/Officejet_6700?ip=172.16.0.2 -m
>> > lsb/usr/HP/hp-officejet_6700.ppd.gz -d Officejet-6700
>> >  touch /root/createdprinter.txt
>> > else
>> >  touch /root/printerexists.txt
>> > fi
>> >
>> > After boot I get the file /root/createdprinter.txt but no printer was
>> > created. if the printer exists before I reboot I get
>> > /root/printerexists.txt so I know the startup script runs properly. I
>> run
>> > the exact lpadmin command as the script in root terminal and works fine.
>> >
>> > Why does that command not want to work in a startup script?  Is the boot
>> > environment different?
>> >
>> > --Thanks
>> > _______________________________________________
>> > cups mailing list
>> > cups at cups.org
>> > https://lists.cups.org/mailman/listinfo/cups
>>
>> _________________________________________________________
>> Michael Sweet, Senior Printing System Engineer
>>
>> _______________________________________________
>> cups mailing list
>> cups at cups.org
>> https://lists.cups.org/mailman/listinfo/cups
>>
>


More information about the cups mailing list