LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-18-2008, 02:49 AM   #1
vodka33us
LQ Newbie
 
Registered: Jun 2008
Posts: 10

Rep: Reputation: 0
making autosricpt for logging and send them to windows using ftp


Code:
#!/bin/bash

NAME=$(hostname)

TIME=$(date +%d%m%Y%H%M)
tail -f /var/log/xferlog > ftp$NAME$TIME.txt
tail -f /var/log/httpd/acces-log > http$NAMR$TIME.txt
ifconfig >> serverinfo$NAME$TIME.txt

HOST='192.168.72.1'
USER='vodka33us'
PASS='signmein'

ftp -i -n -u $HOST << root
user ${USER} ${PASS}

binary

put ftp$NAME$TIME.txt
put http$NAME$TIME.txt
put serverinfo$NAME$TIME.txt

quit
root

rm ftp$NAME$TIME.txt
rm http$NAME$TIME.txt
rm serverinfo$NAME$TIME.txt

SCH=$(cat /root/time_sch.txt)


if [ ! -f STOPFILE ]
then
  at -f autoscript now +$SCH minutes
fi
---------------------------------------------------------------------

time_sch is 10, the file name is autoscript
i put that file in /root and then i chmod 755 autoscript

Code:
chmod 755 autoscript
./autosript
but the result is #!bin/bash there is no file
can you help me??

Last edited by vodka33us; 12-18-2008 at 03:38 AM.
 
Old 12-18-2008, 02:55 AM   #2
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 747

Rep: Reputation: 73
you might have some problem with /bin/bash or is not properly set in the script : #!/bin/bash check it.
 
Old 12-18-2008, 03:22 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Quote:
./autosript

but the result is #!bin/bash there is no file
It is not really clear what is the error. In your post you have put a wrong executable name and a wrong sha-bang in a incomplete error message. Please, can you paste and copy the exact command and the related messages from the terminal? Moreover, use code tags to embed command lines or lines of code: it will preserve spacing and indentation.

Before you ask, to put code tags you can go in advanced mode (see the button at the bottom of the "Quick Reply" box) select the text you want to embed and press the # button from there. Or put the code tags explicitly in the text as in the following example:

[CODE]$ echo Hello vodka33us\!
Hello vodka33us![/CODE]

which will result in
Code:
$ echo Hello vodka33us\!
Hello vodka33us!
 
Old 12-18-2008, 08:02 AM   #4
p_s_shah
Member
 
Registered: Mar 2005
Location: India
Distribution: RHEL 3/4, Solaris 8/9/10, Fedora 4/8, Redhat Linux 9
Posts: 237
Blog Entries: 1

Rep: Reputation: 34
This question may sound stupid to you, but
Have you copied the contents of file from some windows based editor like wordpad to your linux box?
OR
Have you open/modified file on windows and transferred to linux using ftp ?
====
Also try running `which bash` and `whereis bash` for knowing correct path of bash.
====
There are some other things also, which i am not able to get:
Quote:
tail -f /var/log/xferlog > ftp$NAME$TIME.txt
tail -f /var/log/httpd/acces-log > http$NAMR$TIME.txt
did you try to run this command from shell and checked whether it is working or not ?
Because `tail -f ...` is used for runtime log file entries.

Last edited by p_s_shah; 12-18-2008 at 08:04 AM.
 
Old 12-18-2008, 08:08 AM   #5
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 747

Rep: Reputation: 73
Try to remove the "-f" from tail and then try to run the script like this:

sh -x autoscript or sh -x ./autoscript

Good luck!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
making ftp on Windows for Suse 10.0 lhaal1 Linux - Server 0 12-17-2008 04:06 AM
FTP logging rust8y Solaris / OpenSolaris 2 10-09-2008 01:51 AM
Compromised, hacker logging in via FTP stefaandk Linux - Security 7 09-13-2006 07:46 PM
making java applets send packets videoediting Programming 4 05-03-2005 01:48 PM
FTP Logging scottpioso Linux - Security 7 12-27-2003 08:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:25 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration