lundi 1 décembre 2014

Remove tar compress spool from cron email


I have a crontab job that call a simple script to backup a website:



15 0 1,10,20 * * /home/username/bin/backup_whatever


This is the script:



#!/bin/bash
TODAY=$(date +"%Y%m%d")
FILE_TO_PUT="filename.$TODAY.tar.gz"
rm -rf /home/username/filename.tar.gz
tar -zcvf /home/username/filename.tar.gz -C / var/www/website/
s3cmd put /home/username/filename.tar.gz s3://s3bucket/backups/$FILE_TO_PUT


As the tar command compress lots of files, the email I got when this is executed is really huge. How can I do to just display a message like compression successfully instead the full output of tar command?


Will be ok, if I do something like this? Can't find out the tar return codes.



EXITCODE=$(tar -zcvf /home/username/filename.tar.gz -C / var/www/website/)
if [ $EXITCODE -eq 0]
then
echo "compression successfully"
else
echo "compression unsuccessfully"
fi


Run itext script as cups filter


I have an itext script to apply some customisations to pdf files. These need to be done on-the-fly.


I can easily do it this way :



java -cp ".:itext5.jar" pdflayout input.pdf | lpr -P CP800/print


But would rather set up some shareable cups queue that would run the script, so that our graphics people can print to it directly.


Can anyone point me in the right direction?


O/S is Debian Sqeeze.



Portable wrappers for GNU, BSD, etc. versions of tools


Is there any script that provides a compatibility layer to a subset (a rich subset would be best of course) of BSD and GNU commands?


As an example, possible cases handled could include:



  • dd and its incompatible M vs m block size indicator

  • ping and its incompatible -w vs -W wait time option



Automatic login via ssh (no GUI environment installed / no ssh-agent available)?


I have three systems, and I want to have them doing backups between them periodically. The two of them, have Debian Wheezy installed and the other one has Ubuntu 12.04 installed. Only the Ubuntu has a GUI environment, while the other two are CLI only.


For the backups I want to use rsync via ssh, with the Debian systems being the destinations of the backups. I have the commands sorted out and the ssh keys properly generated and copied among the systems, but since the Debian systems do not have a graphical environment installed, the ssh-agent is not run automatically. Therefore, whenever I try to ssh to the Debian systems, I get a prompt for the passphrase.


Is there a way to skip the prompt? From what I understand I cannot use the ssh-agent, when I only have the CLI. I am looking for a solution that works even after a restart without me doing anything after reboot.


Thanks in advance.



Network communication between two nodes in a Hadoop cluster


I am running a 7 node hadoop cluster with each box running Ubuntu 12.04. It is running CDH4 setup using Cloudera Manager. It was already setup and running when I came in but now I'm running into a communication issue between the master and slave1.


The manager GUI says that it cannot communicate with slave1. SSH and Ping to this node from the master fails. However, SSH and PING from all other nodes in the cluster works absolutely fine. I have also verified that the default gateway for all the nodes in the cluster is the same.


I believe it is an issue with the SSH keys between master and slave1 but not sure how exactly to fix it. Would appreciate your help and suggestions.



how to pass command line arguments from c programm to the bash script?


i have written one bash script and now am calling this script from c program. Now i want to pass arguments i.e. argv[1] and argv[2] to the script from command line.



dimanche 30 novembre 2014

How to upload a file from a Unix server to a network drive using Putty?


I want to upload a file from a Unix Server to a network mapped drive using Putty. Now the Network Mapped drive (in Windows) holds an address something like \......... and is named MyDrive I have been trying the following without any success



ftp <<Network Drive Address>>


but it says invalid address



user $USER $PASS
and then put ...


Is this the way should I do it ? Or am I missing something important down here ? Please explain. Any help is much appreciated.