How to increase one hours current date in DEC UNIX 4.0? - date

I need to add one hours to current date in DEC UNIX V4.0?
I tried "date" command but in this version of that command "-v" or "-s" and etc switch doesn't work.
for example:
date -s "5 seconds"
doesn't work.

I assume you have already read the DEC manual page and observed that there is no option that matches the -v or -s options in GNU date. From that, you will conclude that you'll have to write your own code or get someone else's already written code to do the job — and you'll conclude that installing someone else's working code is easier than writing your own code.
The simplest fix, therefore, is to install GNU coreutils and use the date command from that. Of course, there are some tricky bits to deal with. You'll probably not want to install the GNU date command in /bin or /usr/bin because that might break other scripts that expect the DEC version of the date command (it probably won't, but it might, and you're likely to be cautious — if you weren't cautious, you wouldn't still be using DEC UNIX). So, you probably need to add it to /usr/local/bin, or maybe you create a new directory such as /usr/gnu/bin (add --prefix=/usr/gnu to the ./configure command when you build the core utilities). And then you ensure that the commands that need to use GNU date reference it explicitly. (Commands that don't insist on using GNU date should continue to use DEC date.)

Related

Linux-wget command for certain time

I am using wget command for download in terminal
Is there an option in the wget command that the download starts at a certain date and time?
Thanks
Is there an option in the wget command that the download starts at a certain date and time?
So far I know no, you might use at to launch any command at predefined time. Simple example usage: download https://www.example.com at 12:00
echo "wget https://www.example.com" | at 12:00
Note that you need to activate atd (daemon, see linked article) before using at. If you want to know more about possible ways of specifying time read man page of at.

SOLARIS 10 Date Arithmetic

I am using X86 SOLARIS 10 and need the following bash script to get yesterday's date.
#!/usr/local/bin/bash
#ds=`date '+%Y%m%d' -d "+2 days"`
ds=`GMT+24 date +%Y%m%d`
#ds=`date --date yesterday +%Y%m%d`
echo $ds
Getting an error "GMT+24: command not found". Also, tried the methods that are commented without success. Any suggestion
You can't do much date arithmetic with Solaris's own date command. As others have pointed out you'll need GNU date.
See this link, which includes information on getting GNU date (part of GNU coreutils package) on Solaris. Make it a rule to always deploy the minimal GNU tools on your Solaris servers (see link). Make it part of your company's default install. Then you won't get into these issues. Or move to more recent Solaris(*) where GNU date is installed by default.
*) Solaris 10 is getting fairly old now that we're in Dec 2014.

How to have Dexy evaluate Perl scripts?

The dexy documentation states than any language may be used. The tutorial use the py filter to run Python file, but I didn't find any filter to run Perl file.
I try to execute a very simple Perl file
I've tried to use the bash or sh filter, but with no luck, and didn't find any execute-or-like filter.
Am I missing something obvious ?
Ok, here are the different solutions I found about this.
1. A perl filter now exist
Ok, Ana is the owner of this project and is very reactive. I asked her the question about dexy and perl on IRC, and tada ! Less than 1 hour later, there was a commit on the repository with perl support.
So, if you just get latest version and install it this way :
git clone https://github.com/dexy/dexy
cd dexy
sudo pip install -e .
You should have a perl filter.
If you want to pass arguments to a script, just use the scriptargs setting.
2. Use a bash script
Another very simple solution is to embed the launch of a perl script into a sh/bash script, and use the sh/shint/bash filter that already exist.
3. Use bash script without additional files
If you fear that the latest solution will makes you add a lot of tiny scripts in your directories, you may use the contents feature of dexy. That way, the required one-liners are defined in dexy.yaml only.
Something like :
- shell-myscript.sh|sh:
- contents: "perl ./perl/myscript.pl --any-parameter"
- perl/myscript.pl
is doing the job just fine for me.

Why is the backticks operator in Perl not working without the quotes on Windows?

I'm pretty new to Perl, so forgive me if the question is trivial.
At work I have got an assignment to create a script which would send out e-mails when other developers would miss the due date of their tasks. As whole thing would have to work on Windows, using Strawberry Perl, I have used windows command date /T to perform the date check. I have called external commands quite a lot, using the backticks operator, but in this particular case the backticks would not work:
my $date = `date /T`;
Outputs:
date: invalid date `/T'
Fixed using some additional quotes:
my $date = `"date /T"`
Outputs:
Mon 07/07/2014
My question is: why is that?
I would get that if the other external calls with backticks would work the same, but that's the only one I have to call that way, to make it work.
You seem to be accidentally using the Cygwin/GnuTools version of date.
Under a Windows command prompt, date /T gives the current time.
This is not an executable, this is a command.
However, running date /T under the Cygwin/GnuTools environment gives date: invalid date '/T'.
This is because the environment 1) cannot see the Windows date command and 2) finds a date executable in their PATH environment variable and runs it instead.

porting from solaris to linux(i.e sun command)

now i am working in porting (i.e solaris to linux)project..i am using one command i.e sun command in solaris ,but i am not able to find equivalent command in linux .if knows anyone please tell me
following is the man page for sun commamd in solaris(i.e man sun)
User Commands machid(1)
NAME
machid, sun, iAPX286, i286, i386, i486, i860, pdp11, sparc,
u3b, u3b2, u3b5, u3b15, vax, u370 - get processor type truth
value
SYNOPSIS
sun
iAPX286
i386
pdp11
sparc
u3b5
u3b15
vax
u370
DESCRIPTION
The following commands will return a true value (exit code
of 0) if you are using an instruction set that the command
name indicates.
sun True if you are on a Sun system.
iAPX286 True if you are on a computer using an
iAPX286 processor.
i386 True if you are on a computer using an
u370 True if you are on an IBMO System/370 com-
puter.
The commands that do not apply will return a false (non-
zero) value. These commands are often used within makefiles
(see make(1S)) and shell scripts (see sh(1)) to increase
portability.
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Availability | SUNWcsu |
|_____________________________|_____________________________|
SEE ALSO
make(1S), sh(1), test(1), true(1), uname(1), attributes(5)
NOTES
SunOS 5.10 Last change: 5 Jul 1990 2
User Commands machid(1)
The machid family of commands is obsolete. Use uname -p and
uname -m instead.
regards,
ven
Based on what you've added, I'd say that you can replace sun with false, and check the output of uname -p or uname -m instead.
I can find no mention of the sun command in the Solaris documents (either the user or system administration ones). If you mean the sum command, that should be available, or you probably want to look at cksum.
It's possible your command may be a local one in which case you'll need to tell us what it's supposed to do so we can tell you the alternatives. In terms of figuring it out, you should post:
the first bit of output from man sun.
the output of which sun.
the first 20-odd lines from that file (assuming it's a script rather than binary file).
Following your question update, it looks like you have some code that depends on the sun command return value. That will return true on a Sun and false everywhere else.
So the easiest solution is to probably just create a sun script that returns false:
#!/bin/bash
#
# sun command on non-Sun systems
exit 1
However, it's probably not going to be that simple. Obviously there are some platform-specific things going on there that you will have to add code in for Linux. That doesn't directly affect the sun command but all the stuff that happens when sun returns 0 will have to be done for Linux as well.
If you do a uname -o on Linux, you should get back "Linux" somewhere in the string (from memory). That should be enough to identify the operating system which is probably all you need.
The detection of machine and/or processor is probably not that relevant for software unless you're shipping binary executables for all platforms and selecting which ones to run dynamically.