Monday, January 19, 2015

X server and nvidia

  • To stop the X session
    • Hit CTRL+ALT+F1 and login using your credentials.
    • kill your current X server session by typing 
      • sudo service lightdm stop or sudo stop lightdm
    •  If you want to reinstall the nvidia exe
      • Enter runlevel 3 by typing 
        • sudo init 3 and install your *.run file.
    •  You might be required to reboot when the installation finishes. If not, run
      • "sudo service lightdm start"  or "sudo start lightdm" to start your X server again.
    • If you haven't stop the X server at all, you can come back to the X server environment from the command line environment by doing:
      • Hit CTRL+ALT+F7 and login using your credentials.


Tuesday, January 6, 2015

puppet



  • to check if the puppet agent is running:
    •   service puppet status
    • usually, the service is monitoreed and should not be stopped
  • Enable / disable
    • [root@p1al25]# puppet agent --disable "Modification blahblah" --verbose
    • [root@p1al25]# puppet agent --enable --verbose
  • Execute puppet agent
    • puppet agent -t  --debug
    • used to install the latest version of the package
  • check if the agent is enabled or disabled
    • [root@p1al25 ~]# service puppet status
    • puppet (pid 4387) is running...
    • [root@p1al25 ~]# puppet agent --disable "my message" --verbose
    • check if it is disabled or not
      • [root@p1al25 ~]# cat `puppet agent --configprint agent_disabled_lockfile` 
      • {"disabled_message":"reason not specified"}
    • I advise to use --verbose, otherwise you don’t get the errors.
  • In the case herebelow, I was using puppet with a non root user. This user doesn’t have the privilege to create files in its root.
    • bash-4.1$ puppet agent
    • bash-4.1$ puppet agent --verbose
      • Error: Could not set 'directory' on ensure: Permission denied - /data1/toto/.puppet
      • Error: Could not set 'directory' on ensure: Permission denied - /data1/toto/.puppet
      • Wrapped exception:
      • Permission denied - /data1/leguide/ciao/.puppet
  • puppet conf
    • puppet config print
      • is supposed to print what is in
      • less /etc/puppet/puppet.conf
  • puppet certificates
    • server:
      • puppet cert clean lgstagevirt-vm-3s-1.toto.com
      • puppet cert list --all |grep vm
    • client:
      • \rm -r /var/lib/puppet/ssl
      • puppet agent -t -d --waitforcert 30
    • then server:
      • puppet cert sign  lgstagevirt-vm-3s-1.toto.com

Sunday, December 28, 2014

Switch from gnome to text mode

On Ubuntu, you can switch to text mode and go to a tty session.

To switch to 1 to 6 tty session, do
CTRL+ALT+1  for example

To go back to the gnome session, do
CTRL+ALT+7

Wednesday, October 22, 2014

wget


-- doing a post with wget:

wget --post-data="q=(Panasonic)&start=0&rows=1000&wt=json" http://threes1.be.p1.com:8080/solr/offers/for-matching?
store output wget in a file
wget -qO- http://www.cnn.com > toto.txt

Thursday, July 10, 2014

CentOS specific


To disable the firewall installed by default on a new CentOS
> service iptables stop

---- change DNS
[root@stage-vm3 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
/etc/init.d/network restart
vi /etc/resolv.conf

Friday, March 7, 2014

Crontab Survival Kit


# ----- pregen,  */X  means first, first+X, first+2X, etc
55 23 */2 * * cd ~/image/extract-header && bash ./script_pregen.sh
55 23 */3 * * cd ~/image/extract-header && bash ./script_pregen_other_cats.sh

Saturday, August 24, 2013

JavaScript / JQuery Survival Kit


  • JQuery
$(document).ready(function(){
alert( "ready!" ); });