DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-06-13 17:23:48

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

easy howto: move .lpd (and prevent disk spin-ups during printing)

i hate disk spin ups when not needed smile

when printing, lpd uses queue directory to queue files to print. this directory is located on hdd (HD_a4/.lpd) and indeed, the disk spins up whenever you are printing..
so here is quick explanation how to move .lpd queue directory from HD_a4 to USB stick (i guess by now you realized you do need one for this to work smile)
(you could use ram disk but there you have only about 2mb free so it's not recommended)

bold are the new changes i forgot to mention in first revision smile

ok, so first you need to create new directories for lpd to use: i'm using /ffp because that one already points on USB (everything runs from there)
#killall lpd

#mkdir /ffp/var/spool
#chmod 777 /ffp/var/spool
#mkdir /ffp/var/spool/lpd
#chmod 777 /ffp/var/spool/lpd

copy the printcap file (settings) and queue so we have it ready after reboot:
#cp /mnt/HD_a4/.lpd/* /ffp/var/spool/lpd
#cp /usr/local/LPRng/etc/printcap /ffp/var/spool/printcap
#vi /ffp/var/spool/printcap

just change the directory inside, mine looks like this:

Code:

lp|USB Printer:\
        :sh:\
        :ml=0:\
        :mx=0:\
        :sd=/ffp/var/spool/lpd:\
        :lp=/dev/usblp0:\

copy the smb.conf (samba settings) file so we have it ready after reboot:
#cp /etc/samba/smb.conf /ffp/etc/smb.conf

edit the [printers] section in smb.conf to point to your directory
#vi /ffp/etc/smb.conf

Code:

[ printers ]
path = /ffp/var/spool/lpd
guest ok = yes
printable = yes
use client driver = yes
browseable = no



after all this editing, copy the files back to ramdrive, restart smbd, restart lpd and that's it smile:
#cp /ffp/var/spool/printcap /usr/local/LPRng/etc/printcap
#cp /ffp/etc/smb.conf /etc/samba/smb.conf
#smb restart
#lpd&


for the permanent change put these lines in your fun_plug
killall lpd
cp /ffp/var/spool/printcap /usr/local/LPRng/etc/printcap
cp /ffp/etc/smb.conf /etc/samba/smb.conf
smb restart
lpd&

add them further down in the fun_plug file, i have them right above the #run commands ($FFP_RC run)

enjoy smile

Last edited by SilentException (2008-06-25 11:03:38)


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#2 2008-06-13 17:46:56

blahsome
Member
Registered: 2008-03-02
Posts: 157

Re: easy howto: move .lpd (and prevent disk spin-ups during printing)

Very nice!

Offline

 

#3 2008-06-25 02:57:16

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

Re: easy howto: move .lpd (and prevent disk spin-ups during printing)

SilentException wrote:

.....for the permanent change put these lines in your fun_plug
killall lpd
cp /ffp/var/spool/printcap /usr/local/LPRng/etc/printcap
smb restart
lpd&

The above noted changes have been made however the ffp.log file reports an error and printing continues from HD_a4.

The ffp.log shows the following;

killall: No such file or directory
$Shutting down SMB services:
$Shutting down NMB services:
$Starting SMB services:
$Starting NMB services:
Fatal error - Another print spooler active, possibly lpd process '1669'


The fun_plug file was revised to include the following lines;

Code:

USB_LPD_QUEUE=/mnt/USB/ffp/var/spool

# Establish availability of USB Drive and move print queue if available
if [ -d $USB_LPD_QUEUE ]; then
    echo "* Moving Print Queue to USB Drive"
    killall lpd
    cp $USB_LPD_QUEUE/printcap /usr/local/LPRng/etc/printcap
    smb restart
    lpd&
fi

The printcap file was modofied to read as follows;

Code:

lp|USB Printer:\
        :sh:\
        :ml=0:\
        :mx=0:\
        :sd=/mnt/USB/ffp/var/spool/lpd:\ 
        :lp=/dev/usblp0:\

My skills on the Linux side are very limited and I don't understand why these errors are occuring. Any help in this regard would be appreciated.

Bob Blackwell
Pickering, ON


Bob Blackwell
Pickering, ON

Offline

 

#4 2008-06-25 10:50:37

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: easy howto: move .lpd (and prevent disk spin-ups during printing)

seems to me like you've added the lines too soon in fun_plug. (before /ffp symlink is created and/or suid busybox).

try to move it bit more further in the file... i have it just above the last RC_D run... if that fails, use full path to killall (/ffp/bin/killall

also, there is one more thing i forgot to mention in the first post. in /etc/samba/smb.conf there is [ printers ] section. and the "path = " variable in there should be edited to reflect the changes too. will edit the instructions now and make sure you do that part too smile


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#5 2008-06-25 17:05:09

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

Re: easy howto: move .lpd (and prevent disk spin-ups during printing)

Success!!

* Print Queue established on USB Drive (/mnt/USB/ffp/var/spool/lpd)
$Shutting down SMB services:
$Shutting down NMB services:
$Starting SMB services:
$Starting NMB services:



SilentException wrote:

seems to me like you've added the lines too soon in fun_plug. (before /ffp symlink is created and/or suid busybox).

try to move it bit more further in the file... i have it just above the last RC_D run... if that fails, use full path to killall (/ffp/bin/killall

My lines of code were placed at the end of the fun_plug file; same place as your's were placed. I've a sneaking suspicion the USB drive is still being set-up when the killall command was being issued. Adding the full path to the command has corrected the problem.


SilentException wrote:

also, there is one more thing i forgot to mention in the first post. in /etc/samba/smb.conf there is [ printers ] section. and the "path = " variable in there should be edited to reflect the changes too. will edit the instructions now and make sure you do that part too smile

There's always a slight chance the USB drive might not mount so to avoid problems two copies of the smb.conf were placed in the /ffp/etc folder. One file is named smb.conf.default, the other smb.conf.usb. The smb.conf.usb file is copied to the /etc/samba/ directory as smb.conf if the USB drive mounts successfully. As a precaution, the smb.conf.default was left unedited and is copied to the /etc/samba/ directory as smb.conf if the USB drive fails to mount. The following lines were added to the fun_plug file and start the print queue as deemed appropriate;

Code:

USB_LPD_QUEUE=/mnt/USB/ffp/var/spool

<other ffp code removed for clarity purposes>

# Establish availability of USB Drive and move print queue if available
/mnt/USB/ffp/bin/killall lpd
if [ -d $USB_LPD_QUEUE ]; then
    echo "* Print Queue established on USB Drive (/mnt/USB/ffp/var/spool/lpd)"
    cp $USB_LPD_QUEUE/printcap /usr/local/LPRng/etc/printcap
    cp /mnt/USB/ffp/etc/smb.conf.usb /etc/samba/smb.conf
else
    echo "* Print Queue established on Hard Drive (/mnt/HD_a4/.lpd)"
    cp $USB_LPD_QUEUE/printcap /usr/local/LPRng/etc/printcap
    cp /mnt/HD_a2/ffp/etc/smb.conf.default /etc/samba/smb.conf
fi
smb restart
lpd&

I see one downfall of using this approach; if I later changes Samba Shares, it will be necessary to copy and re-edit the /etc/samba/smb.conf file. Any ideas on how this can be avoided?

Bob Blackwell
Pickering, ON

Last edited by rcblackwell (2008-06-25 17:15:35)


Bob Blackwell
Pickering, ON

Offline

 

#6 2008-06-25 22:57:27

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: easy howto: move .lpd (and prevent disk spin-ups during printing)

rcblackwell wrote:

I see one downfall of using this approach; if I later changes Samba Shares, it will be necessary to copy and re-edit the /etc/samba/smb.conf file. Any ideas on how this can be avoided?

sadly, there is no cure for this. its the same if you changed your share name for example.

after editing samba shares using web interface you need to copy smb.conf to your two locations on /ffp. good thing is, in *most cases* you dont need to edit anything (just copy the file) because web interface is smart to add/edit only needed parts of smb.conf (thus keeping your changes intact).

as for the usb not mounted precaution. i have used /ffp in the scripts and /ffp (using my fun_plug) always points to the either hd or usb..

nevertheless i only use vi to edit smb.conf now coz i've added some extra features (like user level security; as opposed to default share one)..

Last edited by SilentException (2008-06-25 23:14:46)


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#7 2008-10-05 15:22:33

nurunet
Member
From: Germany
Registered: 2008-08-31
Posts: 44

Re: easy howto: move .lpd (and prevent disk spin-ups during printing)

Hi there!

Do I understand this correctly, that the Samba settings are overwritten after each boot with the backed up version? So that all possible changes are made undone? What settings are actually stored in this smb.conf?

Regards
Ben


Conceptronic CH3SNAS FW 1.03, ffp from USB key.

Offline

 

#8 2009-05-31 08:14:03

krimb1
Member
Registered: 2008-01-05
Posts: 65

Re: easy howto: move .lpd (and prevent disk spin-ups during printing)

SilentException wrote:

rcblackwell wrote:

I see one downfall of using this approach; if I later changes Samba Shares, it will be necessary to copy and re-edit the /etc/samba/smb.conf file. Any ideas on how this can be avoided?

sadly, there is no cure for this.

Don't mean to dig up an old thread, but couldn't this be cured by a simple sed command? E.g. one could do the following:

# copy existing smb.conf file
cp /etc/samba/samba.conf /mnt/USB/ffp/etc/samba.conf.default

# create a copy USB version that will be edited in place
cp /mnt/USB/ffp/etc/samba.conf.default /mnt/USB/ffp/etc/samba.conf.usb

# replace the the printer's path in place via sed
# note: since the delimitation is arbitrary; commas are used in this case
# rather than the traditional foward slashes, which otherwise would require escaping!
sed -i "s,path = /mnt/HD_a4/.lpd,path = /mnt/freebird/ffp/var/spool/lpd/," smb.conf.usb

# copy samba.conf.usb back, etc.

Or did I miss the point? smile

Offline

 

#9 2009-05-31 23:35:32

michalzxc
Member
Registered: 2008-08-04
Posts: 9

Re: easy howto: move .lpd (and prevent disk spin-ups during printing)

rcblackwell wrote:

I see one downfall of using this approach; if I later changes Samba Shares, it will be necessary to copy and re-edit the /etc/samba/smb.conf file. Any ideas on how this can be avoided?

Edit /etc/samba/smb.default
And update mtd1 and mtd2":
mount -t minix /dev/mtdblock0 /sys/mtd1
cp /etc/samba/smb.default /sys/mtd1/smb.default
sync
umount /sys/mtd1
mount -t minix /dev/mtdblock1 /sys/mtd2
cp /etc/samba/smb.default /sys/mtd2/smb.default
sync
umount /sys/mtd2

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB