Re: rc.local lpadmin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I just found this: I get permission denied. I thought it would run as root. Is this an selinux problem?

$systemctl status rc-local
● rc-local.service - /etc/rc.d/rc.local Compatibility
   Loaded: loaded (/usr/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: disabled)
   Active: active (exited) since Sun 2018-09-09 18:55:45 EDT; 2h 21min ago
     Docs: man:systemd-rc-local-generator(8)
  Process: 873 ExecStart=/etc/rc.d/rc.local start (code=exited, status=0/SUCCESS)

Sep 09 18:55:45 hades.montclaire.local systemd[1]: Starting /etc/rc.d/rc.local Compatibility...
Sep 09 18:55:45 hades.montclaire.local rc.local[873]: /etc/rc.d/rc.local: line 5: /sbin/lpadmin: Permission denied
Sep 09 18:55:45 hades.montclaire.local systemd[1]: Started /etc/rc.d/rc.local Compatibility.


On Sun, Sep 9, 2018 at 9:07 PM Louis Garcia <louisgtwo@xxxxxxxxx> wrote:
I would like to add a printer at system startup if one is not present.

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

_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux