159 Posted Topics
Re: Hello gian! There are lots of ways to do what you're looking for. Perhaps the simplest way, when the pattern you need to replace is so consistent, is to use the 'sed' command. In your script you could replace that part of the filename with something like this: [code] echo … | |
Re: Hi Starfruit! It really depends on which distribution you're using. Most modern distributions have a package manager that will easily set up a default apache installation for you with very little (if any) configuration required. Which Linux distribution are you using? | |
Re: If you just want TCP info from netstat, you can do [icode]netstat -at[/icode], or [icode]netstat -au[/icode] for UDP. You can also get some good information from [icode]lsof -i[/icode] A little late, but I hope this helps! | |
Re: Hi mirasravi! I'm not *exactly* sure what you're looking for, but personally I like to use as few commands as possible for something like this. That being said, your curl example seems like the most efficient. I'm not sure about the syntax though. I think it should be something like … | |
Re: >> Can someone help me understand why "tail -f" it stops writing into myfile.txt Does the log file get rotated at some point? If so, tail is still referencing the OLD version, even though it's been renamed. I've done something similar using tail -f, but also running a monitoring script … | |
Re: I like the stat/diff idea! Do you need to know what files have changed, or just IF they have changed? I have a script that monitors a directory for changes, and then rsyncs it with another server, does some logging, etc... if any changes occur. To check for changes I … | |
Re: Hi Asin! I think what Aia meant was that this forum is a great place to go for help with something that you're working on, but it's not the best place to post a set of requirements and say "write me a script!". If you want somebody to do all … | |
Re: "cd .." is good for moving up a directory, but you should also know that you can get ANYWHERE in the filesystem if you know the full path! :) You can use RELATIVE paths or ABSOLUTE paths. Relative paths are relative to your current working directory. [code] Example of relative … | |
Re: Howdy Gubbu! I'm not sure I understand the end result you're looking for in this script. Is the purpose to see how long it takes to create the gzip file, or to compare time stamps between two different gzip files? Thanks! -G | |
Re: BTW, wget also takes input from a file, so if you had a list of URLs in a file, you could use 'wget -i' Check out the wget man page for some of the other options you can use. It has great capabilities for mirroring sites and things, which is … | |
Re: Here's an example of something I'm using to monitor an application log for a specific error. I'll put some generic variables in :) [code] #!/bin/bash # Set some variables here logfile="/path/to/logfile" pattern="this.is.an.error" email="user@example.com" # read each new line as it gets written # to the log file tail -fn0 $logfile … | |
Re: Nice issue9! I'd probably use 'seq' to generate those numbers personally. Something like this: [icode]seq 1 254[/icode] To generate a list of IPs like in issue's example: [icode]for i in $(seq 1 254); do echo "192.168.0.$i"; done[/icode] You've probably got a solution by now, but I hope this helps somebody! … | |
Re: Hello kenshin, how far have you gotten with this? Anything you can do with grep, you can probably do with awk! For example: [code] grep -y hello filename # is equal to: grep -i hello filename # which is equal to: awk '/hello/i' filename [/code] Hope this gets you going … | |
Re: It was probably a permissions issue. Did you create the .ssh directory manually? If you check the system logs, you'll probably find an error about permissions on the .ssh directory (just a guess). -G | |
Re: Sure! I don't have any examples in front of me, but the Oracle command line client is sqlplus. There are others, but I think sqlplus is the one that ships with Oracle. You should be able to script something that uses sqlplus to get what you need from the database … | |
Re: Hi! I hope you've already found an answer to this, but if not, this thread might help: [URL="http://www.linuxquestions.org/questions/linux-networking-3/dns-rndc-service-errror-229950/"]http://www.linuxquestions.org/questions/linux-networking-3/dns-rndc-service-errror-229950/[/URL] | |
Re: Hi! It's most likely filtered by your ISP. They generally do this to help prevent old, unpatched Windows machines that are directly connected to the internet from being cracked. In general, this isn't a great idea. If you absolutely have to access these files over the internet, I'd recommend using … | |
Re: Or do you mean the full path to the bash binary? [code]$ which bash /bin/bash[/code] | |
Re: Check out tinycore! ([url]http://www.tinycorelinux.com/[/url]) Or P.U.D. Linux! It's based on Ubuntu. SLAX also runs great from a pen drive! For the record, I've run the standard xubuntu on a 2GB stick with no problem, but it was a little cramped for space. I fixed that by setting it up to … | |
Re: That's really odd... It works OK on my system: [icode] $ sed -f DBACheck.sql.sed DBACheck.sql select granted_role from sys.dba_role_privs where grantee='SYSTEM'; [/icode] What version of sed are you using? ([icode]sed --version[/icode]) -G | |
Re: Hmm... Is that the whole script? I'm not seeing the "users" function called anywhere, or even a terminating "}" for the function :) -G | |
Re: Hi! That sounds interesting, but I think we're a little unclear about the details. You mention... "create a menu which will add users doing this in Bash" ...and... "then adding a list of users again using bash" Do you mean that the script should be able to present a menu … | |
Re: Debian is the ORIGINAL "picnic in the park"!!! Apt is the greatest invention ever! Okay, but seriously. If you want to stick with Debian, which I support completely, look into ndiswrapper. Typically, the hard part of getting a wireless adapter to work in Linux is getting the right driver installed. … | |
Re: It's all about what you're comfortable with! Linux can be point-and-click, or you can do it all at command line. I'll also say that if you're running Linux as a web server (with php/mysql/whatever) with light to medium traffic, hardware specs aren't really an issue (I mention this since you … | |
Re: My advice? Try them ALL! At least the mainstream ones. Most everything else is based on one of the mainstream distros. It's all a matter of preference. I started out with RedHat and rpm dependencies drove me nuts... Found Debian a few years later and fell in love with their … | |
Re: Hi Mike, That's certainly an odd problem... Let's compare the output of these commands: $ date "+%a %d %b %Y %X %Z"; hwclock; ntpdate pool.ntp.org That'll tell us if there are any differences between the system clock and the hardware clock, and give us a baseline from ntp. Do you … | |
Re: BillBrown hit it on the head. It's really all about preference. I started out working with RedHat servers, and then experimented with every different distribution I could get my hands on until I discovered the beauty and elegance that I like to call "apt" (the package manager used by Debian … | |
Re: Check out "read"! It will take the user input and do whatever you want with it. [code] read -p "what is your name? " name echo "Nice to meet you $name" [/code] Hope that helps! -G | |
Re: Looks like you need to enclose your $line|sed in both cases! Try this: [code] for line in $(ls *.new); do file1="${line}" file2="$(echo ${line} | sed 's/\(.*\)..../\1/')" diff ${file1} ${file2} done [/code] Hope it helps! -G | |
Re: vim all the way! If it's configured with syntax hilighting and search hilighting, and you can get used to the commands, it's the best ever for command line html/php/any scripting language you can think of. There are some great quick reference materials out there. This isn't the easiest one to … | |
Re: Do you use the temporary file for anything in the meantime? I'm biased against temporary files when they can be avoided, personally... Why not stuff it all into a variable and then stuff it into a file when it's done, or just write directly to the destination file? Here's an … | |
Re: Okay, I needed something to get my mind off work for a few minutes, so here's a quick script I wrote using both of the suggestions above from chris5126 and omrsafetyo. I didn't translate the date, I used the date command to format the date without colons. Here goes, hope … | |
Re: Hi! The problem is that you're not providing a database name! Try this: [icode] mysql -uusername -ppassword database_name ... [/icode] Hope that helps! -G EDIT: And to clarify that error you're getting, since you're surrounding your "-e" with single quotes (' '), and you have single quotes inside the string, … | |
Re: Wow, that's a lot of pipes! I would do it something like this: [code] awk '{TotCPU += $1}{TotMem += $2}END{print "Total CPU= " TotCPU "\nTotal Mem= "TotMem}' test.list [/code] Kinda ugly all in one line, but here it is broken down a little: [code] awk '\ {TotCPU += $1}\ {TotMem … | |
Re: Here's a silly question... Have you tried forcing your NIC on the Windows box to run in 'full duplex' mode? The speed problem is only when going up from the Windows box to the Linux box right? Everything's fine when going from the Windows box to the Linux box? That … | |
Re: One thing to remember about 'sudo su' is that it's not a 'login shell' by default. If you use 'sudo su -l' ('sudo su -' for short) then you'll inherit all of the root user's environment variables, like the path and such. Just curious though, why would you need to … | |
Re: It's just a text file right? What flavor of Unix are you using? You'll probably want to use "vi" or "emacs". If you're not familiar with either of those, you'll probably want to google for some references. Neither of them can really be summed up :) -G | |
Re: Here ya go! [url]http://archives.fedoraproject.org/pub/archive/fedora/linux/core/1/i386/iso/[/url] -G | |
Re: Hi Ajay! I'm not that familiar with Java, so are the System.out messages what gets printed on the command line? If' so, you'll want to run your java app like this: [icode]./java-app >> log.txt[/icode] Seems like I read a similar post, and someone was having trouble getting the error messages … | |
Re: Try using the built in exec command! Also, not sure if that's exactly what you're typing, but you'll need to give "find" a few more arguments... [icode]find . -iname *.dat -prune -exec ls -ltr {}\;[/icode] What this does, bit by bit: find - the command! . - the starting point, … | |
Re: Hi Shwick! I'm not exactly sure what you're trying to do with the usermod command there. If it's giving you the usage, then you've likely got a syntax error somewhere. What's the end result you've got in mind here? On the sudo issue, the "sudo" password is always going to … | |
Re: I think you're looking for read -p I have some examples, but running to a meeting... If you still need help, I'll post it later! -G | |
Re: Doesn't tripwire write a to a report file by default? Maybe you could get the results you're looking for by running tripwire and then parsing the report? Otherwise, I think you're just missing some quotes to hold everything together ;) Try this! [code] #!/bin/sh -e tripwire=/usr/sbin/tripwire [ -x $tripwire ] … | |
Re: Hi Jaoqua! How have you tried so far? Depending on how the file is formatted (are there spaces in some of the commands you want to run?) it should be as simple as: [icode] for i in $(cat /path/to/file); do $i; done [/icode] If there are spaces in the command … | |
Re: That's an interesting one... is the pattern for each one the same as your example? If so, you could do something like: [code] TEST=(A028) ; echo -n ${TEST:2:4}${TEST:0:2} [/code] Maybe? I dunno... -G | |
Re: Are you sure you don't just have to run the .bin file? I've seem some software packaged as .bin or .run. These are usually install scripts that extract their own rpms (or binaries, or source, or whatever) and install them. | |
Re: Hi Manik, you might want to start a new thread, since this was was solved back in March :) If this isn't what you're looking for, please start a new thread with more details. From what you've given us so far, it sounds like you just need to do something … | |
Re: If all that's in that directory is the sym links to the files that you want to tail, try something like this: [icode] for i in $(ls /path/to/directory); do tail -n 21 $i; done [/icode] Let us know how it goes! If we're missing the gist of what you're trying … | |
Re: Hi Rast, To do this with find, try the -cmin switch: [code] -cmin n File’s status was last changed n minutes ago. [/code] EDIT: Or you might be looking for this one: [code] -mmin n File’s data was last modified n minutes ago. [/code] (I got this from the man … |
The End.