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-10-11 13:02:26

Unit106
Member
Registered: 2008-10-06
Posts: 7

FFP 0.5 & Cron & BusyBox v1.00-pre1 ???

In a Telnet session I'm using BusyBox v1.12.1 (2008-09-29 20:38:04 CEST). But when I run the same script scheduled through Cron I'm using BusyBox v1.00-pre1 (2008.03.21-07:56+0000) ???

I'm logged in as Root and this is the result when i do a PS:
1567 root     crond
1622 root     /ffp/sbin/telnetd -l /ffp/bin/sh
1643 root     /ffp/bin/sh

This tells me that Cron also operates as root (right?).

All I want to do is a simple copy command: "cp -al source dest"
Through my Telnet session I works but scheduled I have not the same copy options available.

My test script:

Code:

#!/bin/sh

cp -?  >> /mnt/HD_a2/copyerror.log 2>&1

My NAS is a CH3SNAS with firmware 1.03 and FFP 0.5.

How can i get the same copy options when my scripts are running through Cron?

Offline

 

#2 2008-10-11 13:37:04

KRH
Member
From: Denmark
Registered: 2006-10-27
Posts: 219
Website

Re: FFP 0.5 & Cron & BusyBox v1.00-pre1 ???

use /ffp/bin/cp and not just cp


First user to fun_plug the dns-323.

Offline

 

#3 2008-10-11 14:07:11

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: FFP 0.5 & Cron & BusyBox v1.00-pre1 ???

use #!/ffp/bin/sh instead of #!/bin/sh

Offline

 

#4 2008-10-11 14:34:48

Unit106
Member
Registered: 2008-10-06
Posts: 7

Re: FFP 0.5 & Cron & BusyBox v1.00-pre1 ???

fonz wrote:

use #!/ffp/bin/sh instead of #!/bin/sh

Thanx Fonz, I tried that, it doesn't work :'-(

My test script:

Code:

#!/ffp/bin/sh
echo -Setup 1 >> /mnt/HD_b2/Backup_NAS/copyerror.log 2>&1
cp -? >> /mnt/HD_b2/Backup_NAS/copyerror.log 2>&1

echo -Setup 2 >> /mnt/HD_b2/Backup_NAS/copyerror.log 2>&1
/ffp/bin/cp -? >> /mnt/HD_b2/Backup_NAS/copyerror.log 2>&1

and the output

Code:

-Setup 1
cp: illegal option -- ?
BusyBox v1.00-pre1 (2008.03.21-07:56+0000) multi-call binary

Usage: cp [OPTION]... SOURCE DEST

-Setup 2
/ffp/bin/cp: invalid option -- ?
BusyBox v1.12.1 (2008-09-29 20:38:04 CEST) multi-call binary

Usage: cp [OPTION]... SOURCE DEST

Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY

Options:
    -a    Same as -dpR
    -d,-P    Preserve links
    -H,-L    Dereference all symlinks (default)
    -p    Preserve file attributes if possible
    -f    Force overwrite
    -i    Prompt before overwrite
    -R,-r    Recurse directories
    -l,-s    Create (sym)links

Offline

 

#5 2008-10-11 15:13:10

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: FFP 0.5 & Cron & BusyBox v1.00-pre1 ???

Hm, yes. You don't have ffp environment variables set when running from the firmware crond. Change your script like this:

Code:

#!/ffp/bin/sh
export PATH=/ffp/sbin:/ffp/bin:$PATH

...

Offline

 

#6 2008-10-11 16:47:44

Unit106
Member
Registered: 2008-10-06
Posts: 7

Re: FFP 0.5 & Cron & BusyBox v1.00-pre1 ???

fonz wrote:

Hm, yes. You don't have ffp environment variables set when running from the firmware crond. Change your script like this:

Code:

#!/ffp/bin/sh
export PATH=/ffp/sbin:/ffp/bin:$PATH

...

Great, this works! Thanx.

Is this by design or did I make a mistake somewhere while setting up FFP?

Offline

 

#7 2008-10-11 17:29:50

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

Re: FFP 0.5 & Cron & BusyBox v1.00-pre1 ???

by design. i modify the scripts to include /ffp/etc/profile

Code:

if [ -z ${SOME ENV VARIABLE FROM FFP ONLY, $MAIL WORKS FOR ME} ]; then
  . /ffp/etc/profile
fi

Last edited by SilentException (2008-10-11 17:39:08)


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

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB