Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


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

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



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


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


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


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

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

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

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

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

Last edited by vodka33us; 12-18-2008 at 04:38 AM.
Old 12-18-2008, 03:55 AM   #2
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, 04:22 AM   #3
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

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
$ echo Hello vodka33us\!
Hello vodka33us!
Old 12-18-2008, 09:02 AM   #4
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?
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:
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 09:04 AM.
Old 12-18-2008, 09:08 AM   #5
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!


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 05:06 AM
FTP logging rust8y Solaris / OpenSolaris 2 10-09-2008 02:51 AM
Compromised, hacker logging in via FTP stefaandk Linux - Security 7 09-13-2006 08:46 PM
making java applets send packets videoediting Programming 4 05-03-2005 02:48 PM
FTP Logging scottpioso Linux - Security 7 12-27-2003 09:40 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:43 PM.

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