New Question

Revision history [back]

click to hide/show revision 1
initial version

Local scripts not executed on boot

I am not using any of the services because I am implementing CloudBase with oVirt but that does not correlate with problem.

The problem is that local scripts on Windows server 2012 R2 are not exectured at all!

Because of better view of question I will just put in the post MAIN details of configuration file, log and startup scripts, and full files are on shared dropbox folder https://www.dropbox.com/sh/m5g3v1524h22qh0/AABX6LgntYEgu3NLdvgsTRUWa?dl=0.

CONFIGURATION FILE

NOTE: I removed unattended conf file and the only one left is *cloudbase-init.conf:*

[DEFAULT]

...

localscriptspath=C:\IaaS\LocalScripts\

metadata_services=

plugins=cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin

LOG

The output of the cloudbase-init.log is:

2017-08-21 10:00:51.599 1396 DEBUG cloudbaseinit.osutils.windows [-] Creating logon session for user: .\cloudbase-init createuserlogon_session c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\osutils\windows.py:566

2017-08-21 10:00:51.630 1396 DEBUG cloudbaseinit.osutils.windows [-] Executing process as user, command line: ['C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Scripts\cloudbase-init', '--config-file', 'C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf', '--noresetservicepassword'] executeprocessas_user c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\osutils\windows.py:620

2017-08-21 10:00:52.505 2028 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin' loadclass c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\classloader.py:27 2017-08-21 10:00:52.521 2028 INFO cloudbaseinit.init [-] Executing plugins for stage 'PRENETWORKING':

2017-08-21 10:00:52.521 2028 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin' load_class c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\classloader.py:27

2017-08-21 10:00:52.521 2028 INFO cloudbaseinit.init [-] Executing plugins for stage 'PREMETADATADISCOVERY':

2017-08-21 10:00:52.521 2028 ERROR cloudbaseinit.init [-] No metadata service found

2017-08-21 10:00:52.521 2028 INFO cloudbaseinit.init [-] Plugins execution done

2017-08-21 10:00:55.537 2028 DEBUG cloudbaseinit.osutils.windows [-] Stopping service cloudbase-init stop_service c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\osutils\windows.py:942*

SCRIPTS

And startup batch and PS scripts in C:\IaaS\LocalScripts (the same was not working in default folder C:\Program Files\CloudBase-Solutions..\LocalScripts):

batch.cmd

rem cmd

@echo off

net user Administrator /active:yes

For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)

For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a:%%b)

echo %mydate% %mytime% >> C:\IaaS\cmdoutput.log

echo "BLA BLA TRUC" >> C:\IaaS\cmdoutput.log

NOTE: For this post and regular representation I added before # backslash (\).

test1.ps1

#ps1_sysnative

net user Administrator /active:yes

$dt=Get-Date -Format g

Add-Content c:\IaaS\ps1output.log "$dt - CloudBase works!"

test2.ps1

#ps1

net user Administrator /active:yes

$dt=Get-Date -Format g

Add-Content c:\IaaS\ps1output.log "$dt - Test 2 - CloudBase!"