i have made my machine a freeBSD machine instead of a centos machine and my script doesnt work anymore and i was wondering if anyone can help me into why, i thought the commands are the same, here it is -
Code:
#!/bin/bash
source=/vol/cha-work/_ARCHIVE/to_be_archived/audio
temp=/mnt/archive/temp
dest=/vol/cha-archive/audio
echo "is this archive for an audio tar press (t) or an audio directory press (d)"
read option
d)
cd "$source"
echo "please specify full path to directory you want to be made into a tar"
read -e dir
# echo "please enter ID number ie ID1234"
# read id
# echo "please specify where you want the tar file to be stored"
# read -e dest
cd "$dir"
base=$(basename "$dir")
echo -e "COPY "$base" to "$temp"\n"
echo -e "CREATE "$base".tar in "$temp"\n"
echo -e "COPY "$base".tar to "$dest"\n"
echo -e "REMOVE "$base".tar from "$temp" \n"
echo -e "REMOVE "$base" from "$temp"\n"
echo -e "REMOVE "$base" from "$source"/"$dir"\n"
echo "is this information correct, press (yes) or press (no)"
read correct
case $correct in
yes)
echo "the script will now continue";;
no)
echo "please re-run the script inputting correct details"
exit;;
*)
echo "invalid selection, please re-run the script"
exit;;
esac
date >> /vol/cha-work/_ARCHIVE/inventories/"$base".csv
echo "" >> /vol/cha-work/_ARCHIVE/inventories/"$base".csv
# echo -e ""$id"\n" >> /vol/cha-work/_ARCHIVE/inventories/"$base".csv
echo -e ""$source"/"$dir"\n" >> /vol/cha-work/_ARCHIVE/inventories/"$base".csv
echo -e "how many files = `find . -type f | wc -l`\n" >> /vol/cha-work/_ARCHIVE/inventories/"$base".csv
echo -e "size of directory = `du -sh`\n" >> /vol/cha-work/_ARCHIVE/inventories/"$base".csv
ls -R >> /vol/cha-work/_ARCHIVE/inventories/"$base".csv
cd ..
if ! cp -R "$base" "$temp" ; then
echo "something went wrong with the recursive copy command, please do manually"
exit
fi
cd "$temp"
chmod -R 777 "$temp"
if ! tar -cf "$base".tar "$base" ; then
echo "something went wrong creating the tar, please do manually"
exit
fi
if ! cp "$base".tar "$dest" ; then
echo "something went wrong copying the tar, please do manually"
exit
fi
if ! rm -f "$temp"/"$base".tar ; then
echo "something went wrong removing the tar, please do manually"
exit
fi
if ! rm -rf "$temp"/"$base" ; then
echo "something went wrong removing from temp, please do manually"
exit
fi
cd "$source"/"$dir"
cd ..
if ! rm -rf "$base" ; then
echo "something went wrong removing from source, please do manually"
exit
fi;;
*)
echo "invalid selection, please re-run the script"
exit;;
esac
Howdie everyone...
I have a shell script RemoveFiles.sh
Inside this file, it only has two commands as below:
rm -f ../../reportToday/temp/*
rm -f ../../report/*
My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Hi
I have this code, and i want work with a ls -shalR output in .txt
What i need read to do this??
Where start?
#!/usr/bin/perl
# Allrights- A perl tool for making backups of file permissions
# Copyright (C) 2005 Norbert Klein <norbert@acodedb.com>
# This program is free... (1 Reply)
Hello there,
My mulithreaded application (which is too large to represent the source code here) is crashing after installing FreeBSD 7.1-RELEASE/amd64.
It worked properly on others machines (Dual Cores with 4GB of RAM - FreeBSD 6.2-RELEASE/i386).
The current machine has 2x Core 2 Duo... (1 Reply)
I am working on a script that checks two arguments at the command line. The first argument is a search pattern, the second can be a file or a directory, if it is a file a second script is called that checks it for the search pattern. If the second argument is a directory, it checks for the search... (5 Replies)
Hey i am running both ubuntu 10.10 and windows 7, trying to make the default boot be windows 7 instead of ubuntu but it doesn't want to work. Ive tried changing default in the grub file it didnt work, then i installed startup-manager and set windows 7 as the OS and it still boots into ubuntu. Thx... (3 Replies)
I am a beginner programmer and would like to know where to start to modify the login process so that a user can login as username new password new and have it prompt user for username and password and nothing else and then create said user account on the system so they can ssh back in and login... (9 Replies)
Hi,
This is my first thread on Unix forums, so be gentle.:o
I'm trying to write a simple start/stop script for my wireless networking adapter, under FreeBSD, using the rc.subr framework.
#!/bin/sh
# PROVIDE Wireless
# KEYWORDS shutdown
. /etc/rc.subr
name="wireless"... (1 Reply)
My script work on Linux but not work in sun os.
my script.
logFiles="sentLog1.log sentLog2.log"
intial_time="0 0"
logLocation="/usr/local/tomcat/logs/"
sleepTime=600
failMessage=":: $(tput bold)Log not update$(tput rmso) = "
successMessage="OK"
arr=($logFiles)... (7 Replies)
Hi there,
I'm trying to use loadrunner with freebsd system monitoring tools like rstatd/rup/rsysinfo, but I keep getting this error from loadrunner:
Monitor name :UNIX Resources. Internal rpc error (error code:4). Machine: 192.168.1.15. Hint: Check that RPC on this machine is up and running.... (0 Replies)
Hello
So i got my hands on some freebsd iso, installed it in a qcow2 image and installled git and bash.
So far, so good.
Git repositry retireved
install script executed
files got copied
files have exec flag
files are in $PATH / found by which / bash-completion works
But still,... (3 Replies)