Bekijk de volledige versie : busybox date command problem
mistraller
22-05-2007, 08:52
For my scripts I need the date from 1 or more days before. Normally
date -d "1 day ago"
does the trick, it gives me yesterdays date, on a full linux distribution.
the String value can be several values.
The problem with busybox date command, is that it won't accept the string after the -d option. The man page of busybox tells me nothing about formatting this string.
So if I use the command above on Asus wl500gx I get:
invalid date `1 day ago'
How can I solve this? Or, where could I find more information?
I don't like to dive into calculating days in a month, etc. The script must be compatible with most linux distributions.
(I write in Bash)
the package coreutils contains fully functional version of date utility
mistraller
22-05-2007, 22:53
the package coreutils contains fully functional version of date utility
Thanx! Will try it. At the moment I found a workaround, but the script looks awful because of it.
EDIT: Installed Coreutils, but there's no new date command in it! (Also according to http://ipkgfind.nslu2-linux.org/details.php?package=coreutils&id=8237454&official=)
It's even worse now: All commands are redirected to /opt/bin, but most of them are in /bin. Even after removing coreutils.
So at the moment, my scripts are dead.
EDIT2: A reboot saved me, all commands will go to /bin now. But still no better date command. Should I also install busybox again, although I run already an Oleg build?
as far as I remember coreutils conflicts with external busybox which can also be installed through ipkg and installs the links to the utilities in also /opt/bin
Installed Coreutils, but there's no new date command in it!
still it is there (including manpage):
root@wl500g,~> /bin/date --version
/bin/date: unrecognized option `--version'
BusyBox v1.1.3 (2007.01.01-14:37+0000) multi-call binary
Usage: date [OPTION]... [MMDDhhmm[[CC]YY][.ss]] [+FORMAT]
root@wl500g,~> /opt/bin/date --version
date (GNU coreutils) 6.7
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by David MacKenzie.
All commands are redirected to /opt/bin, but most of them are in /bin
what the problem is? If you have 2 versions of the same command in /bin and in /opt/bin then to select one of them you just have to set the PATH variable in correct search order or use full path when execute the program
Should I also install busybox again, although I run already an Oleg build?
NO! Oleg's build contains early version of busybox in read-only location: /bin You can't remove it, you just have an option not to use it.
If you 'ipkg install busybox' you install latest version of busybox in /opt/bin
If you 'ipkg install coreutils' it installs full versions of the utilities also in /opt/bin
So, first, make sure that you get rid of everything related to external busybox: busybox busybox-links busybox-base (BTW this is not easy). After that install coreutils
BTW http://ipkgfind.nslu2-linux.org/details.php?package=coreutils&id=8237454&official= is wrong. You see it has more references to manpages than to the utilities themselves. If you are in doubt --- download the ipk file to PC and watch the content by archiver (ipk is renamed .tar.gz file)
mistraller
23-05-2007, 09:11
I only have the built-in busybox version 1.1.3, there's no external version installed.
About the Coreutils package; I thought I had the right one:
Version 6.7-3 from optware_oleg_cross_stable
But as mentioned, it has no date command in it, only the man pages. And after installing the package all links were exclusively pointing to /opt/bin, although /bin was also in my path.
for instance, a command like ls, (or date) took me to a "not found in /opt/bin" error, I had to issue /bin/ls to get it working.
If updating busybox with coreutils is really that hard, I will stick with my workaround.
(I use my router as datalogger for solar system, so I really don't like it when I brick my asus)
I still only can repeat that this package: http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/coreutils_6.7-3_mipsel.ipk contains date utility. Download it and check the content.
And after installing the package all links were exclusively pointing to /opt/bin, although /bin was also in my path.
Actually, coreutils installs in the /opt/bin not links, but real separate binaries.
for instance, a command like ls, (or date) took me to a "not found in /opt/bin" error, I had to issue /bin/ls to get it working.
Possibly, there is something wrong with your libraries. Make sure that you have ipkg-opt and uclibc-opt correctly installed
If updating busybox with coreutils is really that hard
I just mentioned that external busybox conflicts with coreutils, but if you don't have it there should not be a problem
Finally, please show your PATH variable:
export PATH