Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. #
  4.  
  5. LocalDir=/var/mail
  6. TempDir=/tmp/mail/backup-`date +%d-%m`
  7. Archive=mail-`date +%d-%m`.bak.tgz
  8. Ruser=ftptest
  9. Rpass=1024
  10. Rdir=/
  11. Rserver=127.0.0.1
  12.  
  13. # Initial checking and packing
  14. if [ -e $TempDir ]; then
  15. echo "$TempDir exists quitting"
  16. else
  17. mkdir -p $TempDir
  18. cp -Ra $LocalDir $TempDir
  19. fi
  20.  
  21. if [ -e $TempDir ]; then
  22. tar -czvf $Archive $TempDir
  23. else
  24. echo "$TempDir not found qutting"
  25. fi
  26.  
  27. # FTP
  28. ftp -n -i $Rserver <<EOF
  29. user $Ruser $Rpass
  30. cd $Rdir
  31. ls
  32. EOF
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. #!/bin/bash
  44. #
  45. #A script which runs as a posthook for tea4cups.
  46. #It calculates the number of pages of a printing job from a user
  47. #and creates a log.
  48. #See declarations for which parameters should be given from the tea4cups posthook.
  49. #
  50. #Author: Christian Ã….
  51. #20100225
  52.  
  53.  
  54. #DECLARATIONS
  55. #These are given by the posthook_billing in /etc/cups/tea4cups.conf
  56. declare IP="$1"
  57. declare JOBID="$2"
  58. declare PRINTER="$3"
  59. declare PAGES=`pkpgcounter $4`
  60. declare USER="$5"
  61. declare MAC=`ssh orestad@tank ./macfinder.sh $1`
  62. declare DATE=`date | sed 's/ /-/g'`
  63. declare PLIST="/billing/prints"
  64.  
  65. #If log is removed or rotated a new one will be created here
  66. #First line will be todays date.
  67. if [ ! -f $PLIST ]; then
  68. echo `date` > $PLIST
  69. chmod 644 $PLIST
  70. fi
  71.  
  72. #Logs the current printing job
  73. echo "$IP::$MAC::$USER::$PAGES::$JOBID::$PRINTER::$DATE" >> /billing/prints
  74.  
  75. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement