Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export ID=$(echo $(who am i| awk '{print $1}'|xargs))
- export now=$(date '+%d%b%H%M%S')
- read -p "hosts' file location " location
- function2
- function_in_background(){
- echo "proceding in background.." >> $LOG
- while IFS= read -r i
- do
- (echo $i;sudo -i -u username ssh -q -o "StrictHostKeyChecking no" -o "NumberOfPasswordPrompts 0" -o ConnectTimeout=2 $i "cd /$i"_"${now}/ &&
- ./script update --start /$i"_"${now}/logs/update.xml --output /$i"_"${now}/logs" ) >> "${file_save}-${i}.txt" 2>&1 &
- done < "$file_name"
- wait
- while IFS= read -r i
- do
- cat "${file_save}-${i}.txt"
- rm "${file_save}-${i}.txt"
- done < "$file_name" > "$LOG"
- ( cat $LOG ; echo -e "nn" ; ) | mailx -s "update completed" -a $LOGS -c "xyz@exchange.corp"
- break;
- }
- function2(){
- LOG="/tmp/logs_${ID}_${now}"
- UPDATE="/tmp/update${ID}_${now}"
- cat $LOG| grep '[[*]]' > $UPDATE
- if [ $COUNT -gt 0 ];then
- echo "`tput setaf 3`Below are the updates recommended`tput sgr0`"
- cat $UPDATE|grep [*]
- export now
- export ID
- export LOG
- export location
- export -f function_in_background
- nohup bash -c flash &>>$log &
- else
- echo "There are no update..exiting"
- echo " "
- exit 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement