logfile problem

logfile problem

Post by Francesca Bon » Sat, 13 Jan 2001 23:04:24



I have a simple shell that print a file. The file, the printer, the user are inputs to insert. It runs: the is if i want a log file, where it doesn't write the right information. Where do i wrong?
I hope to be clear, thanks for your help
Francesca

This is the code of my shell:

LOGFILE=./stampa.log

touch stampa.log

provanuminput()

{

echo $#

# se il num di parametri introdotti e' diverso da 4

if [ $# -ne 4 ]

then

echo "Il numero di parametri introdotti non e' corretto"

# esci

exit 0;

fi

echo "Viene introdotta la richiesta di stampa"

Quote:}

lanciastampa()

{

if [ $1 != "1" ]

then

echo "L'operazione richiesta non e' valida"

# esci

exit 0;

fi

echo "inviata richiesta di stampa"

echo $4

rsh 190.10.0.85 -l $4 lp -d $2 $3

./shfra2.sh >>$LOGFILE

status=$?

if [ "$status" != 0 ]

then

# echo $status >>$LOGFILE

echo "stampa non eseguita "$status >> $LOGFILE

exit $status

fi

# echo $status >>$LOGFILE

echo "stampa terminata con successo "$status >>$LOGFILE

Quote:}

main()

{

provanuminput $1 $2 $3 $4

lanciastampa $1 $2 $3 $4

Quote:}

main $1 $2 $3 $4
 
 
 

logfile problem

Post by <scott.walkins.. » Sun, 14 Jan 2001 10:42:43


I don't quite understand the problem - if the correct information isn't being redirected to the logfile you'll have to tell us what shfra2.sh does, and what IS being written to the log file - apart from that it seems okay tho can be shortened a bit...

#!/bin/ksh
provanuminput() {

  echo $#

  # se il num di parametri introdotti e' diverso da 4

  [ $# -ne 4 ] && echo "Il numero di parametri introdotti non e' corretto" && exit 1

  echo "Viene introdotta la richiesta di stampa"

Quote:}

 lanciastampa() {

  [ "$1" != "1" ] && echo "L'operazione richiesta non e' valida" && exit 1

  echo "inviata richiesta di stampa"

  echo "$4"

  rsh 190.10.0.85 -l "$4" lp -d "$2" "$3"

  ./shfra2.sh >> $LOGFILE

  STATUS=$?

  # echo $STATUS >> $LOGFILE

  [ $STATUS -ne 0  ] && echo "stampa non eseguita $STATUS" >> $LOGFILE && exit $STATUS

Quote:}

LOGFILE="stampa.log"


exit 0


  I have a simple shell that print a file. The file, the printer, the user are inputs to insert. It runs: the is if i want a log file, where it doesn't write the right information. Where do i wrong?
  I hope to be clear, thanks for your help
  Francesca

  This is the code of my shell:

  LOGFILE=./stampa.log

  touch stampa.log

  provanuminput()

  {

  echo $#

  # se il num di parametri introdotti e' diverso da 4

  if [ $# -ne 4 ]

  then

  echo "Il numero di parametri introdotti non e' corretto"

  # esci

  exit 0;

  fi

  echo "Viene introdotta la richiesta di stampa"

  }

  lanciastampa()

  {

  if [ $1 != "1" ]

  then

  echo "L'operazione richiesta non e' valida"

  # esci

  exit 0;

  fi

  echo "inviata richiesta di stampa"

  echo $4

  rsh 190.10.0.85 -l $4 lp -d $2 $3

  ./shfra2.sh >>$LOGFILE

  status=$?

  if [ "$status" != 0 ]

  then

  # echo $status >>$LOGFILE

  echo "stampa non eseguita "$status >> $LOGFILE

  exit $status

  fi

  # echo $status >>$LOGFILE

  echo "stampa terminata con successo "$status >>$LOGFILE

  }

  main()

  {

  provanuminput $1 $2 $3 $4

  lanciastampa $1 $2 $3 $4

  }

  main $1 $2 $3 $4

 
 
 

1. logfile problems

Hi,

   I upgraded one of my older systems to debian 2.2 yesterday, and
   came back tonight to find that it had run out of disk space on the
   root partition.

   As this is an older system, the size of root partition is only 100
   megs. (hey, that was more space than I needed back in 1994...:-)

   The main culprits seem  to be the various log files (especially
   squid is eating a lot of space).

   I'm wondering: can I move the /var/log directory to a different
   filesystem, one that is not available at boot time, or would that
   lead to dataloss ?

   Failing that, is there anyway I can resize my partitions (e.g. by
   removing an unused swap system ) or perhaps move my partitions
   around ? (preferably in such a way that my system continues to
   run.. It's my main mail/net gateway..)

   The partition map currently looks like this; the FAT 16 systems are
   old dos partitions which are no longer in use:

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1       610    307408+   6  FAT16
/dev/hda2           611      2477    940968    5  Extended
/dev/hda5           611       712     51376+   6  FAT16
/dev/hda6   *       713       916    102784+  83  Linux
/dev/hda7           917       949     16600+  82  Linux swap
/dev/hda8           950      2477    770080+  83  Linux

    Thanks for any help,

                TimT.

2. aix-digest V3 #594

3. Logfile problems

4. HELP configuring X with CLGD7543

5. split-logfile Problems, PLEASE HELP!!!

6. StarOffice 5.2 RedHat Linux 7.1 Network Installation

7. "su" logfile problem on SCO 5.0.2

8. Searching PDF documents on a Netra web server

9. Problems with grabbing data from a logfile and updating a database

10. Problems with Restoring Backup - logfile

11. truncating a growing logfile

12. better than "$cmd 2>&1 | cat - > $logfile" ?

13. Can't get the same logfile with crontab