-->
Showing posts with label sys admin. Show all posts
Showing posts with label sys admin. Show all posts

Monday, January 20, 2014

mounting devices

mounting an iso:

sudo mount -o loop Office_ProPlus_2013_VL_32Bit_En-US-Sep2013.iso  iso/
sudo mount -o loop ml2012au.iso  /media/matlab


mounting an iso:

sshfs -o idmap=user $USER@:/media/source ~/destination

Thursday, May 2, 2013

crontab tweakings


Remember to place a minimal configuration in your /etc/crontab or in your crontab -e


MAILTO=luca.marchesotti@gmail.com
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:~/bin



Exec format error (in cron)
If you are like me, you sometimes get lazy and forget to include the shell command at the top of your scripts. This usually isn't a problem, but in certain cases (where the shell isn't set, or doesn't exist yet) it will cause problems. So, even if your script is set to be executable (chmod +x), you'll receive an error like:

Exec format error


Just such a case manifests itself when using a script through cron (and run-parts). To remedy this problem put the following at the beginning of the script:

#!/bin/sh

Credit: 
Brian Oneill

Tuesday, April 30, 2013

daily crontab


For simple "daily", "weekly", "monthly" jobs, put a copy of or a symlink to the script in one of the /etc/cron.{daily|weekly|monthly} directories above. 

Anacron will take care of running it daily/weekly/monthly, and if your computer is off on the day the "weekly" scripts would normally run, it'll run them the next time the computer is on.

Thursday, March 21, 2013

calculate load of individual machines on a cluster


Use :

$ uptime


Output:

20:57:50 up 196 days,  1:36,  4 users,  load average: 4.00, 4.00, 4.42


The load averages reported are system load averages for the last 1, 5 and 15 minutes respectively.

Note that a  load average of 1 means there's enough work being done by the system to keep 1 CPU busy 100% of the time. (So either 1 process taking 100% or 2 processes taking each 50% etc.) A load average of 2 would likewise be enough to consume 100% of 2 CPU's. Etc.

Combine it with pssh to simultaneously check the load on multiple machines :

$ pssh -h ~/bin/spiders.pssh -o ./cluster.log "uptime"

Tuesday, March 19, 2013

Setting System-wide proxies in ubuntu


From this excellent post


Ubuntu Studio, like Xubuntu, uses the XFCE desktop environment which does not contain a graphical settings tool to set systemwide proxies (unlike the default Ubuntu desktop environment, Unity).

1. Set up the proxy/proxies for most programs

  • Open the /etc/environment file with gksudo leafpad (or your favorite editor). This file stores the system-wide variables initialized upon boot.
  • Add the following lines, modifying appropriately. You must duplicate in both upper-case and lower-case because (unfortunately) some programs only look for one or the other:
    http_proxy=http://myproxy.server.com:8080/
    https_proxy=http://myproxy.server.com:8080/
    ftp_proxy=http://myproxy.server.com:8080/
    no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
    HTTP_PROXY=http://myproxy.server.com:8080/
    HTTPS_PROXY=http://myproxy.server.com:8080/
    FTP_PROXY=http://myproxy.server.com:8080/
    NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com"
    

2. Then set up proxies for GTK3 programs such as Rhythmbox:

Some newer GTK3 programs such as Rhythmbox ignore the environment variables set above, and rely on Gnome settings instead. To make sure they are covered, open a terminal and paste the below line-by-line, modifying as appropriate:
gsettings set org.gnome.system.proxy mode 'manual' 
gsettings set org.gnome.system.proxy.http host 'myproxy.server.com'
gsettings set org.gnome.system.proxy.http port 8080

3. Finally, set up the proxies for apt-get and Update Manager

  • These programs will not obey the environment variables either. Create a file called 95proxies in/etc/apt/apt.conf.d/, and include the following:
    Acquire::http::proxy "http://myproxy.server.com:8080/";
    Acquire::ftp::proxy "ftp://myproxy.server.com:8080/";
    Acquire::https::proxy "https://myproxy.server.com:8080/";
    
Finally, logout and reboot to make sure the changes take effect.

Monday, March 18, 2013

command line emails from ubuntu

frome the excellent post of  http://askubuntu.com/questions/12917/how-to-send-mail-from-the-command-line


  • Install ssmtp Install ssmtpsudo apt-get install ssmtp
  • Edit the ssmtp config file : gksu gedit /etc/ssmtp/ssmtp.conf
  • Enter this in the file:
    root=username@gmail.com
    mailhub=smtp.gmail.com:465
    rewriteDomain=gmail.com
    AuthUser=username
    AuthPass=password
    FromLineOverride=YES
    UseTLS=YES

    you can then use 
    mutt or mailx to send your emails from command line

Sunday, March 10, 2013

enable daemon.log in ubuntu

Cups + Samba + windows 7 printer configuration



chronicle of the end of a nightmare....

server side

1. have cups properly configured

2. have samba configured and sharing the printers


[print$]                                                                                                                                                                                                        
   path = /var/lib/samba/printers                                                                                                                                                                               
   browseable = yes                                                                                                                                                                                             
   write list = @adm root                                                                                                                                                                                       
   guest ok = yes                                                                                                                                                                                               
   inherit permissions = yes                                                                                                                                                                                    
   # Settings suitable for Winbind:                                                                                                                                                                             
   # write list = @"Domain Admins" root                                                                                                                                                                         
   # force group = +@"Domain Admins"     


[printers]                                                                                                                                                                                                      
   comment = All Printers                                                                                                                                                                                       
   path = /var/spool/samba                                                                                                                                                                                      
   browseable = yes                                                                                                                                                                                             
# to allow user 'guest account' to print.                                                                                                                                                                       
   guest ok = yes                                                                                                                                                                                               
   writable = no                                                                                                                                                                                                
   printable = yes                                                                                                                                                                                              
   create mode = 0700                                                                                                                                                                                           
# =====================================                                                                                                                                                                         
# print command: see above for details.                                                                                                                                                                         
# =====================================                                                                                                                                                                         
   print command = lpr-cups -P %p -o raw %s -r   # using client side printer drivers.                                                                                                                           
#   print command = lpr-cups -P %p %s # using cups own drivers (use generic PostScript on clients).                                                                                                             
# If you install drivers on the server, you will want to uncomment this so                                                                                                                                      
# clients request the driver                                                                                                                                                                                    
   use client driver = yes     

client side (win 7) 
  1. from explorer connect to your server:  \\192.168.1.3\your_server
  2. double-click on the icon of the printer 
  3. select drivers and the printer should automagically install on your computer
BE CAREFUL:
if your samba client requires a password don't forget to login through explorer first!!!


Thursday, October 25, 2012

fix svn problem within a shared virtualbox directory


svn problem:

Get subversion version 1.6.12 

 s
Patch subversion  source code with this patch

install libaprutil-1-dev from synaptic


install neon


  1. apt-get install openssl  
  2. wget http://www.webdav.org/neon/neon-0.29.6.tar.gz  
  3. tar -xzvf neon-0.29.6.tar.gz  
  4. rm neon-0.29.6.tar.gz   
  5. cd neon-0.29.3  
  6. ./configure --with-ssl  
  7. make   
  8. make install  


compile subversion with :

sudo ./configure --with-ssl  --with-neon=/usr/local

Wednesday, September 26, 2012

Windows pills

Start/stop services  and applications, also selects the applications at startup

msconfig

Check out the net


ipconfig /all | more 

Kill all processes related to a specific service

1. Task Manager -> performance -> resource monitor,
2. select the process you want to kill,
3. right click, go to service and kill! 


this is yet another modification