Publicado en Ubuntu, Uncategorized

Linux Server Daily Reboot

Schedule a daily reboot with cron

Type:

sudo crontab -e
[sudo] password for user:
no crontab for root - using an empty one

Select an editor. To change later, run 'select-editor'.
 1. /bin/nano <---- easiest
 2. /usr/bin/vim.tiny

Choose 1-2 [1]:
crontab: installing new crontab

Add:

# m h dom mon dow command
40 1 * * * /sbin/reboot

In this case Every Day at 01:40 AM

Thanks to https://stackoverflow.com/questions/15393875/using-cron-to-reboot

Publicado en Ubuntu

Add Tomcat as Service Linux (Systemd)

Create file tomcat-systemd on  /etc/systemd/system/tomcat-systemd.service

nano /etc/systemd/system/tomcat-systemd.servicee

 

# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=forking

Environment=JAVA_HOME=/opt/tomcat/jdk1.8.0_121
Environment=CATALINA_PID=/opt/tomcat/apache-tomcat-7.0.75/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat/apache-tomcat-7.0.75/
Environment=CATALINE_BASE=/opt/tomcat/apache-tomcat-7.0.75/
Environment='CATALINE_OPTS=-Xms1G -Xmx1G -Djava.net.preferIPv4Stack=true'
Environment='JAVA_OPTS=-Djava.awt.haedless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/apache-tomcat-7.0.75/bin/startup.sh
ExecStop=/opt/tomcat/apache-tomcat-7.0.75/bin/shutdown.sh
#ExecStop=/bin/kill -15 $MAINPID

User=tomcat
Group=tomcat

[Install]
WantedBy=multi-user.target

Enable and start service

systemctl enable tomcat-systemd.service
systemctl start tomcat-systemd.service

We can test OK with:

ps -ef |grep java
systemctl status tomcat-systemd.service

Thanks to https://gist.github.com/obatiuk/15c84fb25826d4f39a303a454087e85a for systemd Script.

Publicado en HyperV, Seguridad, Ubuntu, Windows

How to configure iLO from command line (HPe)

Si nos encontramos que tenemos que reconfigurar la IP de la placa ILO (OOB para HP) y no tenemos acceso desde esa LAN por algun motivo, podemos:

Teniendo instalado «HP Lights-Out Online» incluído en el «Service Pack for ProLiant»

 

Goto C:\Program Files\HP\hponcfg> or %ProgramFile%\HP\hponcfg

 

Then type:

hponcfg /w ilo.xml

this dumps iLO configuration into ilo.xml file

<RIBCL VERSION=”2.0″>
<LOGIN USER_LOGIN=”user” PASSWORD=”password”>
<RIB_INFO MODE=”WRITE” >
<MOD_NETWORK_SETTINGS>
<IP_ADDRESS VALUE = “x.x.x.x”/>
<SUBNET_MASK VALUE = “x.x.x.x”/>
<GATEWAY_IP_ADDRESS VALUE = “x.x.x.x”/>
<PRIM_DNS_SERVER value = “x.x.x.x”/>
<DHCP_ENABLE VALUE = “N”/>
</MOD_NETWORK_SETTINGS>
</RIB_INFO>
</LOGIN>
</RIBCL>

NOTE: The USER_LOGIN and PASSWORD tags are required, and must contain data, although any data is accepted.

 

Change IP related values and:

hponcfg /f ilo.xml

this writes new configuration back to the iLO and voilá.

 

Based on  Scripting Toolkit for Windows – Using HPONCFG also available on Linux.

 

Thanks to https://srvops.wordpress.com/2012/02/13/how-to-configure-ilo-from-command-line/

 

Publicado en HyperV, scvmm, Windows

After installing Hyper-V Integration Services on the next reboot the VM displays BSOD 0x0000007B – P2V Hyper-V Guest BSOD 0x0000007e wdfldr.sys

After a P2V from an old server a BSOD was showing. I see same error related to WDFLDR.SYS.

Solution:

  1. Boot the VM into LastKnownGood. Press F8 during boot.
  2. Open the Registry and drill down to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Wdf01000 There is a Group Value that should have the Value WdfLoadGroup. In my cases it was wrongly set to base… Change this to WdfLoadGroup
  3. Then remove the Integration Components from Control Panel/Software.
  4. Reboot the VM (now without ICs)
  5. Install the ICs once again

Thanks to robertvi2 from https://blogs.msdn.microsoft.com/robertvi/2009/10/07/after-installing-hyper-v-integration-services-on-the-next-reboot-the-vm-displays-bsod-0x0000007b/ to help to resolve this.

Publicado en Windows

Enable/Disable Network interface via command line

Start elevated Command Prompt.

Get NIC list and index number:

wmic nic get name, index

Enable NIC with index number: (eg: 7)

wmic path win32_networkadapter where index=7 call enable

Disable NIC with index number: (eg: 7)

wmic path win32_networkadapter where index=7 call disable

Thanks To EddieZA from https://answers.microsoft.com/en-us/windows/forum/windows_7-hardware/enabledisable-network-interface-via-command-line/17a21634-c5dd-4038-bc0a-d739209f5081

Publicado en Ubuntu

Add Davmail as Service Linux (Systemd)

Create file davmail-systemd on  /etc/systemd/system/davmail-systemd.service

nano /etc/systemd/system/davmail-systemd.service
[Unit]
Description=DavMail gateway service
After=syslog.target
After=network.target

[Service]
Type=simple
User=root
Group=root
ExecStart=/opt/davmail/davmail.sh /opt/davmail/davmail.properties
TimeoutSec=120

[Install]
WantedBy=multi-user.target

 

systemctl enable davmail-systemd

systemctl start davmail-systemd

We can test trafic with:

tail -f /opt/davmail/nohup.out

Thanks to https://github.com/stdevel/davmail-initscript/blob/master/davmail-systemd for systemd Script.