geostorm.org


UTC 09:40:42
Thursday
11/21/2024



November 2024
SuMoTuWeThFrSa 
     12 
3456789 
10111213141516 
17181920212223 
24252627282930 
        
Calendar Tool

welcome

Miscellaneous - Linux Reference

Here are some solutions to problems Linux users often encounter. If you have a better solution or
have a question please send your solutions, questions, or comments to us.
Are any of these solutions obsolete? Are they clear and easy to understand?

Miscellaneous Notes
How do I create a swap file on demand while Linux is running?
rpm notes
How do I set system and hardware clock date and time?
Is it possible for the computer to set its own clock?

How come I can't run programs in current directory?
Why is my shell ignoring the current directory?
How do I put a "dot" in the path at login?

How do I spin down my hard drive after 1 hour? (hdparm)





[TOP]





How do I create a swap file on demand while Linux is running?
To create swapfile:

dd if=/dev/zero of=swapfile bs=1024 count=65536
  where count=size in KB. that one is 64MB
   (divided by binary thousand, 1024)
mkswap swapfile
sync
swapon swapfile

/etc/fstab contains important filesystem mount info.
e.g.,
/dev/hda6  swap  swap  defaults  0  0
man fstab
gives you a good description of what these parts mean.

The advantage of this is that it allows you to create extra virtual
memory when needed. You need it when real memory (and maybe permanent
swap if you made one) runs low. The bad part of this is that it is slow
and fragmented. Anyone think different?

[TOP]



rpm notes
To install a rpm package
rpm -i package.1.2.3.rpm
where package.1.2.3.rpm is the package.
This installs all necessary files to default locations.
Now if for some reason you get an error saying that you cannot
install it because of some dependencies. You could
force it to ignore dependencies or you could find out what
libraries are needed. To ignore dependencies:
rpm -i --nodeps package.1.2.3.rpm
You may run into errors or the program may not run at all
if it doesn't get its libraries.

uninstalling a rpm package:
rpm e package.1.2.3


what do I have installed?

rpm -a -q |less


rpm to a specified dir:

man rpm and search for --root and --dbpath


[TOP]



How do I set system and hardware clock date and time? Is it possible for the computer to set
its own clock?

To set current time:

/sbin/clock (hwclock)
date --set

to set system (BIOS) time:
hwclock --systohc


example:
date -s 12:34:56
This will set the system time in this format hh:mm:ss

date -s 991031
This will set the system date in this format  oct 31 1999

hwclock --systohc
This will sync your system (software) date and time to your hardware
clock.



To set your date and time automatically; to sync it to an official time
source type:

ntpdate time-nw.nist.gov
hwclock --systohc

where time-nw.nist.gov is a time source, an address.
Other addresses are:

Server name                     ip address      Note    Location

time-b.nist.gov                 129.6.16.36     2       Maryland
time-b.timefreq.bldrdoc.gov     132.163.135.131 2       Colorado
utcnist.colorado.edu            128.138.140.44  2       Colorado
time-nw.nist.gov                131.107.1.10    2       Washington
utcnist1.reston.mci.net         204.70.131.13   2       Virginia
nist1.datum.com                 209.0.72.7      2       California
y2k-test.timefreq.bldrdoc.gov   132.163.135.136 2,6     Colorado
time-a.nist.gov                 129.6.16.35     1       Maryland
time-a.timefreq.bldrdoc.gov     132.163.135.130 1,4     Colorado
time-c.timefreq.bldrdoc.gov     132.163.135.132 5,2     Colorado
time-d.timefreq.bldrdoc.gov     132.163.135.133 3       Colorado
time.nist.gov                   192.43.244.18   1       Colorado

Notes:
1. Heavily loaded and not recommended for new users.
2. Recommended for new users.
3. Used for testing only. Not for general users.
4. Does not support anonymous ftp connections.
5. Supports NTP service only -- no other time formats and no ftp
   connections.
6. This server transmits time messages that are 2 years in the future for
   testing the y2k performance of client systems. It is for test purposes
   only and should not be used to synchronize operational systems or
   those that are not prepared to handle dates in the year 2000 and
   beyond.

More addresses can be found at www.nist.gov

[TOP]



How come I can't run programs in current directory? Why is my shell ignoring the current
directory? How do I put a "dot" in the path at login?


cannot execute binary problem:
instead of doing 
./myProg
to run a program in current dir.

Put a "." in path with:
PATH='.:$PATH'

If you are using:

Slackware:
Include this line in your ~/.bash_login or ~/.login or ~/.csh startup
script:
PATH=$PATH":."  

Redhat and Mandrake:
Include this line in your ~/.bashrc file
PATH=$PATH":."  

SuSE:
Run YaST
or 
Include this line in your ~/.profile file
PATH=$PATH":."  

[TOP]



How do I spin down my hard drive after 1 hour? (hdparm)
Hard drive spin down

hdparm -S 1 /dev/hda <---spin down HDD in 5 seconds
hdparm -S 241 /dev/hda <---spin down HDD in 30 Min
-S option: 0 to disable, 1-240 = 5sec - 20 Min.
          241-250= 30Min - 5.5 Hr
the scheme is described in
man hdparm

-----

crond/crontab

*/1 * * * *  /root/tmp/xbin 1> /dev/null 2> /dev/null
this would run a program every minute
this part "1> /dev/null 2> /dev/null" will redirect mail to null.
everytime crond does  something the user gets an email about it.

crontab found at /var/spool/cron/
play with crond/crontab. it prevents hdparm from spinning
down hdd because cron periodically writes to hdd.

set it to
0 * * * * /myprog <--do it at 00 of the hour

-----

update
Slackware:
/etc/rc.d/rc.K rc.S files set update to : update -f 3600 &
flushes buffers every hour
or just dont run it at all
ad an alias s='sync'
ad an alias ='/usr/lib/atrun' <---or whatever is listed in crontab dir
now you dont have update or crond running in the bg.

-----

system logs

/etc/syslog.conf
logs are found in /usr/adm
when user logs in etc...

put a ''-'' before the file like this
''*.=info;*.=notice              -/usr/adm/messages''
to prevent it from syncing the file

[TOP]