Monday, February 12, 2018

Stop+Disable and Make Automatic+Start Windows Services using PowerShell.

When you need to make sure all Cisco services (Windows services) are stopped and set to manual but you need to do this on 20 servers and there's at least 10 services per server then you start doing things like this:

Stop and set Startup type to Manual:


Get-Service |Where-Object {($_.DisplayName -like 'Cisco*')} |foreach {Stop-Service $_.Name}
Get-Service |Where-Object {($_.DisplayName -like 'Cisco*')} |foreach {Set-Service $_.Name -StartupType Manual}
Set Startup type to Automatic and start:


Get-Service |Where-Object {($_.DisplayName -like 'Cisco*')} |foreach {Set-Service $_.Name -StartupType Automatic}
Get-Service |Where-Object {($_.DisplayName -like 'Cisco*')} |foreach {Start-Service $_.Name}

Wednesday, January 18, 2017

This was a life saver after a 14.04->16.06 Ubuntu (in VMWare) et0 disappeared

http://askubuntu.com/questions/824376/failed-to-start-raise-network-interfaces-after-upgrading-to-16-04

Thursday, February 11, 2016

Tuesday, March 18, 2014

If df -i gives you 100%, use this

cd /
sudo find . -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n

Via http://www.kossboss.com/freeinodes

Wednesday, September 18, 2013

List entities of an ICM script



USE ccc_awdb
SELECT scr.*,
CASE(scr.TargetType)
WHEN 1 THEN 'Service'
WHEN 2 THEN 'Skill_Group'
WHEN 3 THEN 'Agent'
WHEN 4 THEN 'Translation_Route'
WHEN 7 THEN 'Call_Type'
WHEN 8 THEN 'Enterprise_Service'
WHEN 14 THEN 'Peripheral'
WHEN 16 THEN 'Trunk_Group'
WHEN 17 THEN 'Route'
WHEN 20 THEN 'Master_Script'
WHEN 33 THEN 'Network_Vru_Script'
WHEN 37 THEN 'Expanded_Call_Variable'

END AS Type,
CASE(scr.TargetType)
WHEN 1 THEN (SELECT EnterpriseName FROM Service WHERE SkillTargetID = scr.ForeignKey)
WHEN 2 THEN (SELECT EnterpriseName FROM Skill_Group WHERE SkillTargetID = scr.ForeignKey)
WHEN 3 THEN (SELECT EnterpriseName FROM Agent WHERE SkillTargetID = scr.ForeignKey)
WHEN 4 THEN (SELECT EnterpriseName FROM Translation_Route WHERE SkillTargetID = scr.ForeignKey)
WHEN 7 THEN (SELECT EnterpriseName FROM Call_Type WHERE CallTypeID = scr.ForeignKey)
WHEN 8 THEN (SELECT EnterpriseName FROM Enterprise_Service WHERE EnterpriseServiceID = scr.ForeignKey)
WHEN 14 THEN (SELECT EnterpriseName FROM Peripheral WHERE PeripheralID = scr.ForeignKey)
WHEN 16 THEN (SELECT EnterpriseName FROM Trunk_Group WHERE TrunkGroupID = scr.ForeignKey)
WHEN 17 THEN (SELECT EnterpriseName FROM Route WHERE RouteID = scr.ForeignKey)
WHEN 20 THEN (SELECT EnterpriseName FROM Master_Script WHERE MasterScriptID = scr.ForeignKey)
WHEN 33 THEN (SELECT EnterpriseName FROM Network_Vru_Script WHERE NetworkVruScriptID = scr.ForeignKey)
WHEN 37 THEN (SELECT EnterpriseName FROM Expanded_Call_Variable WHERE ExpandedCallVariableID = scr.ForeignKey)
END AS EnterpriseName
FROM Master_Script ms
INNER JOIN Script s ON s.MasterScriptID = ms.MasterScriptID AND s.Version = ms.CurrentVersion
INNER JOIN Script_Cross_Reference scr ON scr.ScriptID = s.ScriptID
WHERE ms.EnterpriseName = 'NM_AkviziceEL'

Friday, July 19, 2013

[Grails] Use Domain.withNewSession instead of refresh()

Waaaaaaay faster.
For instance, if you have a service run by a scheduled recurring Quartz job, the service seem to be attached to a thread which does not see the updated fields in the database (always returns cached values). We may refresh the whole domain calling the refresh() method on the domain class instance, or just do this:

def allCampaigns
        Campaign.withNewSession{ session ->
            allCampaigns = Campaign.findAll("from Campaign where myStatus IN ('active','paused') OR myStatus = null")
        }


Saturday, July 6, 2013

Cleaning up /boot


dpkg --get-selections|grep 'linux-image*'|awk '{print $1}'|egrep -v "linux-image-$(uname -r)|linux-image-generic" |while read n;do apt-get -y remove $n;done