LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-05-2013, 08:02 AM   #1
sudi267
LQ Newbie
 
Registered: Sep 2012
Distribution: debian ubuntu
Posts: 10

Rep: Reputation: Disabled
Question pls help in my bash script to transfer logs to aws s3,kindly suggest changes...


hi
i have shell script below that should transfer logs of "myapp"
to aws s3 service in bucketname "mybucket12345"
$1 is the path to read files from
$2 should be name of directory inside mybucket in s3

pls kindly suggest the changes...

#!/bin/bash
$1="/var/log/myapp/*.bz2"


for i in $1
do
/usr/bin/s3cmd -c ~/.s3cfg put "$i" s3://mybucket12345/$2/$(hostname -f)/$(date +%Y)/$(date +%m)/$(date +%d)

if[$? eq 0]
then
rm -f "$i" #should execute on success
else
echo "$i file not removed"
exit 4
done



i have configured s3cmd that asks for aws_access_key etc..
so the script should simply uploads all the log files with extension *.bz2 to s3
 
Old 03-05-2013, 08:25 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,008

Rep: Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193
Firstly, please place your code in [code][/code] tags so it is easier to read and follow.

Secondly, are you saying this script actually works??

I cannot see the second line of the script ever working, nor the for loop for that matter.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pls suggest me . PyaeSone Linux - Newbie 5 09-03-2012 08:45 PM
BASH script won't die when user logs out. arizonagroovejet Linux - General 14 11-06-2009 02:37 AM
pls suggest khushal Linux - Software 5 10-30-2009 09:05 PM
kindly suggest , its urgent. ankur0921 Linux - Newbie 8 05-01-2009 12:54 PM
Using BASH script to transfer a file via (s)ftp senther Linux - Newbie 2 07-19-2005 04:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration