Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I run logadm on my Solaris 10 machine I get exe status - 1.

My target is to run the command with exe status - 0

What do I need to do in order to run my logadm successfully and to get exe status – 0?

  star1a:/ ROOT > /usr/sbin/logadm -rv hw-alarms_2
  # loading /etc/logadm.conf
  # processing logname: hw-alarms_2
  # /etc/logadm.conf unchanged


  star1a:/ ROOT > echo $?
  1
share|improve this question
    
WHY WHY WHY I get (-1) -:( –  yael Aug 27 '12 at 9:13

1 Answer 1

up vote 0 down vote accepted

If hw-alarms_2 isn't a defined logname you can't get an exit status of 0 with the command you're using.

Your command

logadm -rv hw-alarms_2

is asking to have entries corresponding to the log name hw-alarms_2 removed from the /etc/logadm.conf file.

The exit status of 1 is telling you that an error occurred. The verbose output says that /etc/logadm.conf unchanged, this is most likely because you don't have a log name hw-alarms_2 defined.


You do realise that -r option to logadm removes the specified logname from logadm.conf don't you ?

-r

Remove any entries corresponding to the specified log-name from the /etc/logadm.conf.

So once you've run your command once successfully it won't do so again unless you change the logname to remove or put the original back in.

e.g. add an entry to logadm.conf

logadm -C2 -w mylog /my/really/long/log/file/name

delete it

logadm -rv mylog
# loading /etc/logadm.conf
# processing logname: mylog
# writing changes to /etc/logadm.conf
echo $?
0

Now try and delete it again

logadm -rv mylog
# loading /etc/logadm.conf
# processing logname: mylog
# /etc/logadm.conf unchanged
echo $?
1

We can't because we previously deleted it. So lets add it back in

logadm -C2 -w mylog /my/really/long/log/file/name

and delete it again

logadm -rv mylog
# loading /etc/logadm.conf
# processing logname: mylog
# writing changes to /etc/logadm.conf
echo $?
0

Bingo !

share|improve this answer
    
not clearly , for example logadm -rv hw_alarms_1 was with exe status 0 in spit hw_alarms_1 not exist in logadm.conf , so why hw_alarms_1 was with exe status 0 and hw_alarms_2 with exe status 1 , both them not defined in the file logadm.conf –  yael Aug 26 '12 at 10:09
    
@yael: what happens if you run logadm -rv hw_alarms_1 now ? –  Iain Aug 26 '12 at 10:12
    
sorry my mistake logadm -rv hw_alarms_1 with exe status 1 -:) , –  yael Aug 26 '12 at 10:17
    
It may have existed the first time you ran the command but having deleted it subsequent runs will give an error. –  Iain Aug 26 '12 at 10:19
    
is it possible to restore the logadm.conf before the last change ? –  yael Aug 26 '12 at 10:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.