  FastEddie iMod join:2000-12-29 Channel Z
Host: All Things Unix Mozilla Software Cyberonic Rogers Gadgets
| reply to alien9999999 Re: Little Known Tips and Tricks...
Pssst! Look over to your left at the Forum Links
 Map for those that can't find this thread
-- Here's To You |
|
  alien9999999 Your Head Looks Nice Premium join:2002-05-21 B-3000 | reply to Happyrat hmm, strange... it should be sticky...
you better sitemark it, just in case -- Alien is my name and headbiting is my game. |
|
  Happyrat Google Is Your Best Friend Premium join:2002-07-01 Disneyland
| reply to dom6791 Why is this thread no longer sticky? Most of the info presented in this thread is timeless... --
Satan Loves You... »fuzzyrat.com |
|
  armitage
join:2004-01-04 philippines
·mydestiny cable
| reply to dom6791 I dont recall where or when I found this, but just in case that you cat a binary file while in a terminal (before starting X), hit -
ctrl-v ESC-C
and that'll reset your terminal to normal...
haven't seen this work in FreeBSD though (but I can cat a bin file and still have a normal term in BSD though). -- Windows? It's a pack of instant noodles. Convenient, but not very healthy. Linux? Well, linux is the kitchen. |
|
  a398274
@cox.net | reply to dom6791 Hate when your cursor disappears?
tried a reset? clear?
invisible cursor no more!
|
|
  alien9999999 Your Head Looks Nice Premium join:2002-05-21 B-3000 | reply to dom6791 i don't want to sound arrogant, but i feel this might be usefull: »Installing IPv6 Server -- Alien is my name and headbiting is my game. |
|
  hohumdedumdum
@anduin.org
| reply to dom6791 No offense dom6791 , but that's just crazy. There's no need to do that.
ls -d */
That's it.
Also, your for loop will only work so long as the directory names have no spaces in them. |
|
 dom6791
join:2001-11-23 Bronx, NY 1 edit | reply to ghost16825 In the event someone ever wanted to list only directories:
for i in * ; do if [ -d $i ]; then echo $i ; fi ; done
hohumdedumdum, True!  |
|
 ghost16825 Use security metrics Premium join:2003-08-26
3 edits | reply to dom6791 Gentoo installer/user tip:
This is more or less a RTFM tip rather than anything really brilliant. (Yes, I admit it - I occasionally do read the manual)
What should really be more prominent in the Official Gentoo docs is the elog system - logs info, warning messages etc when emerging.
#In your /etc/make.conf
#The default save directory for these logs is /var/log/portage/elog/ PORTAGE_ELOG_CLASSES="info warn error log qa" PORTAGE_ELOG_SYSTEM="save" #or save_summary for all the critical information in one file rather than separately. |
|
  weeksben1 Premium join:2004-02-26 Clarkston, MI | reply to dom6791 Just want to say thanks for the tips and tricks. Its great for showing us *nix rookies, some new (at least to us) stuff. -- Ben WeeksNetwork AdminNovell CNA NW3.2/4.x/5.xNetwork + Certified |
|
 dom6791
join:2001-11-23 Bronx, NY
| reply to dom6791 Didnt see this one in the list
If you have many files in a directory that you want to execute consecutively, but dont want the hassle of manually running one at a time:
find /tmp/syncfiles -name 'sync*' -exec sh {} \;
This will find all files that begin with 'sync' in the /tmp/syncfiles directory and execute one at a time. This saved me lots of time since it takes 7 hours sometimes. Now I can just start it and walk away.  |
|
  Daniel Premium,MVM join:2000-06-26 Pleasanton, CA clubs: 
4 edits | reply to dom6791 With lsof you can use the -t and -u switches to kill everything a user has open:
kill -9 `lsof -t -u daniel` Use with care. ;) |
|
  yock TFTC Premium join:2000-11-21 Fairfield, OH
| reply to timcuth Re: Start a script based on reception of a file
said by timcuth :I really think this thread should be edited into the ATU FAQ, as it is getting to be next to impossible to find anything specific in such a long thread. That's a great idea. If users feel so inclined, they can submit their FAQ suggestions to this page and the system will IM the FAQ editors that there are new suggestions for the FAQ. In fact, Maxo sent us one just today.
No_Strings and I are slowly making our way through the FAQ in a massive cleanup effort, so anything you guys can add would be welcome. -- Wiki Wiki Laughter is the closest distance between two people. --Victor Borge |
|
  timcuth Braves Fan Premium join:2000-09-18 Pelham, AL clubs:
·AT&T Southeast
1 edit | reply to dom6791 I don't know whether this already has been posted. I really think this thread should be edited into the ATU FAQ, as it is getting to be next to impossible to find anything specific in such a long thread.
Anyway, this week at work I was required to initiate a batch script upon reception of an FTP'ed file, rather than scheduling the job at a regular time. I did a Google search and then added my own twists, coming up with a very nice solution.
Since the batch script runs for about 10 minutes, I decided to check for the incoming file every 15 minutes during the range of times when the file might arrive (3 AM - 9 AM, Tue - Sat):
00,15,30,45 3-9 * * 2-6 /path/check_for_file.sh
check_for_file.sh runs the UNIX find command to look for the incoming file with a timestamp newer than the output file that is created by the batch script. When the newer input file is found, the find command starts the batch script:
find /expimp/blah -name input_file.txt -newer /path/output_file.txt -exec /path/batch_script.sh \;
Works like a charm!
Tim
-- The shortest sentence is, "I am". The longest is, "I do". ~ Project Hope ~ |
|
  timcuth Braves Fan Premium join:2000-09-18 Pelham, AL clubs:
·AT&T Southeast
| reply to timcuth Re: Little Known Tips and Tricks...
Here is the info I was asking about:
When a binary executable file has been given the setuid attribute, normal users on the system can execute this file and gain the privileges of the user who owns the file (commonly root) within the created process. When root privileges have been gained within the process, the application can then perform tasks on the system that regular users normally would be restricted from doing. The invoking user will be prohibited by the system from altering the new process in any way, such as by using ptrace, LD_LIBRARY_PATH or sending signals to it (signals from the terminal will still be accepted, however).
»en.wikipedia.org/wiki/Setuid
Apparently, the Oracle program I set this on then allows other users to execute it with the privileges of oracle, not root.
Tim -- The shortest sentence is, "I am". The longest is, "I do". ~ Project Hope ~ |
|
  timcuth Braves Fan Premium join:2000-09-18 Pelham, AL clubs:
·AT&T Southeast
1 edit | reply to gatessux said by gatessux :Sorry, I should of read all the replies before posting this... Good one, I just wanted to furthur help out... It's binary, as stated above, you need to do it 3 times for each, User of the file, Group that has rights, and Others (everyone else). Here's a cheat table... ------------ RWX 000 = 0, no rights 001 = 1, eXecute 010 = 2, Write 011 = 3, Write/eXecute 100 = 4, Read 101 = 5, Read/eXecute 110 = 6, Read/Write 111 = 7, Read/Write/eXecute (if it's 0 it's false, if it's 1, it's true) Also: chown = change owner, chgrp = change group A great reference can be found here as well : » www.tldp.org/LDP/intro-linux/htm···_04.htmlThanks... Could someone expand on the above info to explain "sticky bits"? I have to use them in my job as an Oracle DBA, and I follow the instructions and get them correctly, but I have no idea what they mean or what exactly I am doing.
E.g., some Oracle database programs have to have "chmod 7455" in order to work. If you then display the program, you see "-rwsr-s---". (I am not sure my chmod command example and my mode display match, exactly).
I think it has something to do with the programs running with root authority, but I don't understand the why or the how.
Thanks, Tim
PS - I knew even less than I thought. The actual chmod command was "chmod 4755" (not 7455) and it is called "setuid". My system administrator saw me do it and he was the one who called it "the sticky bit".
Anyway, I found some info in this article: »en.wikipedia.org/wiki/Chmod
Sorry. -- The shortest sentence is, "I am". The longest is, "I do". ~ Project Hope ~ |
|
  yock TFTC Premium join:2000-11-21 Fairfield, OH
| reply to Steve
said by Steve :Why not: if cal $mon $year | grep -qw $day then echo "do stuff here if it's a valid date" else echo "invalid date entered" fi No need for the variable set when you can check for the result directly in the "if" Steve — who nevertheless would have not thought to do it this clever way I think a *LOT* of people forget about return codes when shell scripting...myself included. This script is a perfect example of why they're so damned useful.
-- Wiki Wiki The more secretive a government is, the more skeptical we need to be. --Shepard Smith |
|
  Mordy Comfortably Numb Premium,MVM,ExMod 2004-07 join:2001-12-02 Denver, CO 1 edit | reply to Steve (topic move) Little Known Tips and Tricks...
Moderator Action The post that was here (and all 6 followups to it), has been removed. |
|
  Steve I'm a PC, so shut up Consultant join:2001-03-10 Yorba Linda, CA
| reply to deblin Re: Little Known Tips and Tricks...
Why not:
if cal $mon $year | grep -qw $day then echo "do stuff here if it's a valid date" else echo "invalid date entered" fi No need for the variable set when you can check for the result directly in the "if"
Steve — who nevertheless would have not thought to do it this clever way
-- Stephen J. Friedl Unix Wizard Microsoft Security MVP Tustin, California USA my web site |
|
  deblin Dark Side of the Moon Premium,MVM join:2001-09-01 Middletown, DE
| reply to dom6791 Quick and easy way to check for a valid date with "cal", which is pretty ubiquitous.
is_valid=0 cal $mon $year | grep -qw $day && is_valid=1 if [ $is_valid == 1 ]; then echo "do stuff here if it's a valid date" else echo "invalid date entered" fi -- "Talk is cheap because the supply is greater than the demand" - Shelby Friedman |
|