01-29-2002
your VAR is getting the return value of the system call, 0 for success try this to get the logname into the variable
#!/usr/bin/perl
$var=`logname`;
print $var;
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi friends,
I want to use query string value to another variable but it gives following error when I use it with print out command,
Insecure dependency in open while running with -T switch at C:/Program Files/Apache Group/Apache2/cgi-bin/cdr_findere.pl line 119.
My code as follows,
my... (0 Replies)
Discussion started by: maheshsri
0 Replies
2. UNIX for Dummies Questions & Answers
i have to do an assingment using mailx, where can i find info on mailx?
*yes i read the rules, so i am not asking for the asnwers, just need to learn about mailx more (1 Reply)
Discussion started by: punk_87
1 Replies
3. Shell Programming and Scripting
Hi
How do i assign the output of a unix command to a variable ? say i want the whoami output to be assigned to a variable?
Thanks (2 Replies)
Discussion started by: PrasannaKS
2 Replies
4. Shell Programming and Scripting
Hi All,
I am trying to convert the below Csh while loop into Perl while loop but the problem is that in this csh script, i have 2 variables inside a variable -> $count is a variable {SB$count} as a whole is another variable. Csh is able to assign values to such variable like the below but i do... (3 Replies)
Discussion started by: Raynon
3 Replies
5. Shell Programming and Scripting
hi i have following code
my $a1 = "A" ;
my $a2 = "B" ;
my $a3 = "C" ;
foreach my $k ( 1,2,3 )
{
my $msg = ${a{$k}} # this should be at runtime i am creating variable a1 and assigning it value to msg .
print "$msg\n" ;
}
above thing is not working !!!
i want when k = 1... (4 Replies)
Discussion started by: zedex
4 Replies
6. Shell Programming and Scripting
Hey all,
perl - how can we name a variable base on the value of another variable?
for example in ksh/bash we do :
export c="100"
export x`echo $c`=2000
echo $x100
x100=2000
is it possible to do something similar for perl?
I already tried many ways but nothing is working.
I am... (3 Replies)
Discussion started by: cacm1975
3 Replies
7. Shell Programming and Scripting
Hi,
I want to count the number of occurences of a character in a string variable ($str). The character is stored in a another variable ($sepchr). I am using tr as :
$count = ($str =~ tr/$sepchr//);
This did not work. I found in another thread about using eval. I used eval as :
... (13 Replies)
Discussion started by: sinpeak
13 Replies
8. Shell Programming and Scripting
Hi,
I have the following lines that I would like to see in an array for easy comparisons and printing:
Example 1:
field1,field2,field3,field4,field5
value1,value2,value3,value4,value5Example 2:
field1,field3,field4,field2,field5,field6,field7... (7 Replies)
Discussion started by: ejdv
7 Replies
9. Shell Programming and Scripting
Hi, guys, i have a script i inherited from a coworker but i'm not perl savy. The script works but i would like it to work better. I want to run this command
./ciscomgrtest.pl -r "show version" -h hosts.router
and have the script goto each router in the hosts.router file and run the command... (2 Replies)
Discussion started by: whipuras
2 Replies
10. Shell Programming and Scripting
Q 1. Write a shell script to print the following pattern upto n (specified by user)-
@
@@
@@@
@@@@
@@@
@@
@
Please help! :) (1 Reply)
Discussion started by: heatedline
1 Replies
LEARN ABOUT DEBIAN
upslog
UPSLOG(8) NUT Manual UPSLOG(8)
NAME
upslog - UPS status logger
SYNOPSIS
upslog -h
upslog [OPTIONS]
DESCRIPTION
upslog is a daemon that will poll a UPS at periodic intervals, fetch the variables that interest you, format them, and write them to a
file.
The default format string includes variables that are supported by many common UPS models. See the description below to make your own.
OPTIONS
-h
Display the help message.
-f format
Monitor the UPS using this format string. Be sure to enclose format in quotes so your shell doesn't split it up. Valid escapes within
this string are:
%%
Insert a single "%"
%TIME format%
Insert the time with strftime formatting
%ETIME%
Insert the number of seconds, ala time_t. This is now a 10 digit number.
%HOST%
insert the local hostname
%UPSHOST%
insert the host of the UPS being monitored
%PID%
insert the pid of upslog
%VAR varname%
insert the value of variable varname
The default format string is:
%TIME @Y@m@d @H@M@S% %VAR battery.charge% %VAR input.voltage%
%VAR ups.load% [%VAR ups.status%] %VAR ups.temperature%
%VAR input.frequency%
-i interval
Wait this many seconds between polls. This defaults to 30 seconds.
If you require tighter timing, you should write your own logger using the upsclient(3) library.
-l logfile
Store the results in this file.
You can use "-" for stdout, but upslog will remain in the foreground.
-s ups
Monitor this UPS. The format for this option is upsname[@hostname[:port]]. The default hostname is "localhost".
-u username
If started as root, upsmon will setuid(2) to the user id associated with username for security.
If username is not defined, it will use the value that was compiled into the program. This defaults to "nobody", which is less than
ideal.
SERVICE DELAYS
The interval value is merely the number given to sleep(3) after running through the format string. Therefore, a query will actually take
slightly longer than the interval, depending on the speed of your system.
LOG ROTATION
upslog writes its PID to upslog.pid, and will reopen the log file if you send it a SIGHUP. This allows it to keep running when the log is
rotated by an external program.
SEE ALSO
Server:
upsd(8)
Clients:
upsc(8), upscmd(8), upsrw(8), upsmon(8)
Internet resources:
The NUT (Network UPS Tools) home page: http://www.networkupstools.org/
Network UPS Tools 05/21/2012 UPSLOG(8)