Crontab Issues

I’m not entirely sure if this is an IronRuby or a Mono issue, but here
goes! I have a test suite that we’re running on my Ubuntu server that
works
fine when I SSH in and run it manually, but when it tries to run from a
cron job I get the following exceptions:


WARNING: The runtime version supported by this application is
unavailable.
Using default runtime: v1.1.4322

** (/home/rob/code/ironlangs/bin/
Release/ir.exe:4798): WARNING **: Missing method .ctor in assembly
/home/rob/code/ironlangs/bin/Release/Microsoft.Scripting.dll, type
System.Diagnostics.CodeAnalysis.SuppressMessageAttribute

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: The
class System.Diagnostics.CodeAnalysis.SuppressMessageAttribute could not
be
loaded, used in Microsoft.Scripting

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: Can’t
find custom attr constructor image:
/home/rob/code/ironlangs/bin/Release/Microsoft.Scripting.dll mtoken:
0x0a00008c

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **:
Missing
method .ctor in assembly
/home/rob/code/ironlangs/bin/Release/Microsoft.Scripting.dll, type
System.Diagnostics.CodeAnalysis.SuppressMessageAttribute

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: Can’t
find custom attr constructor image:
/home/rob/code/ironlangs/bin/Release/Microsoft.Scripting.dll mtoken:
0x0a00008c

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **:
Missing
method .ctor in assembly
/home/rob/code/ironlangs/bin/Release/Microsoft.Scripting.dll, type
System.Diagnostics.CodeAnalysis.SuppressMessageAttribute

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: Can’t
find custom attr constructor image:
/home/rob/code/ironlangs/bin/Release/Microsoft.Scripting.dll mtoken:
0x0a00008c

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: The
class System.OperatingSystem could not be loaded, used in mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: The
class System.OperatingSystem could not be loaded, used in mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: The
class System.OperatingSystem could not be loaded, used in mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Unhandled Exception: System.TypeInitializationException: An exception
was
thrown by the type initializer for
Microsoft.Scripting.PlatformAdaptationLayer —>
System.TypeLoadException:
Could not load type ‘System.OperatingSystem’ from assembly ‘mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.
at Microsoft.Scripting.PlatformAdaptationLayer…cctor () [0x00000] in
:0
— End of inner exception stack trace —
at IronRuby.Hosting.RubyConsoleHost…ctor () [0x00000] in :0
at Host…ctor () [0x00000] in :0
at Host.Main (System.String[] args) [0x00000] in :0


Does anybody know why this might happen?

Thanks,
Rob

The error looks to be with running Mono under cron

WARNING: The runtime version supported by this application is
unavailable.
Using default runtime: v1.1.4322

That’s indicating mono is loading it’s version of the .NET 1.1 framework
(which dates to 2003), instead of the .NET 4.0 framework (2010), which
is
what is supported.

As to why mono under cron isn’t supporting .NET 4, I’m unsure. I’d
suspect
something to do with your PATH or other environment variables that
differ
when run under your local user account vs cron.

From: Rob B.ton [email protected]
To: [email protected]
Date: 06/12/2011 04:28 a.m.
Subject: [Ironruby-core] Crontab Issues
Sent by: [email protected]

I’m not entirely sure if this is an IronRuby or a Mono issue, but here
goes! I have a test suite that we’re running on my Ubuntu server that
works fine when I SSH in and run it manually, but when it tries to run
from a cron job I get the following exceptions:


WARNING: The runtime version supported by this application is
unavailable.
Using default runtime: v1.1.4322

** (/home/rob/code/ironlangs/bin/
Release/ir.exe:4798): WARNING **: Missing method .ctor in assembly
/home/rob/code/ironlangs/bin/Release/Microsoft.Scripting.dll, type
System.Diagnostics.CodeAnalysis.SuppressMessageAttribute

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: The
class System.Diagnostics.CodeAnalysis.SuppressMessageAttribute could not
be loaded, used in Microsoft.Scripting

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: Can’t
find custom attr constructor image:
/home/rob/code/ironlangs/bin/Release/Microsoft.Scripting.dll mtoken:
0x0a00008c

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **:
Missing
method .ctor in assembly
/home/rob/code/ironlangs/bin/Release/Microsoft.Scripting.dll, type
System.Diagnostics.CodeAnalysis.SuppressMessageAttribute

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: Can’t
find custom attr constructor image:
/home/rob/code/ironlangs/bin/Release/Microsoft.Scripting.dll mtoken:
0x0a00008c

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **:
Missing
method .ctor in assembly
/home/rob/code/ironlangs/bin/Release/Microsoft.Scripting.dll, type
System.Diagnostics.CodeAnalysis.SuppressMessageAttribute

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: Can’t
find custom attr constructor image:
/home/rob/code/ironlangs/bin/Release/Microsoft.Scripting.dll mtoken:
0x0a00008c

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: The
class System.OperatingSystem could not be loaded, used in mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: The
class System.OperatingSystem could not be loaded, used in mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

** (/home/rob/code/ironlangs/bin/Release/ir.exe:4798): WARNING **: The
class System.OperatingSystem could not be loaded, used in mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Unhandled Exception: System.TypeInitializationException: An exception
was
thrown by the type initializer for
Microsoft.Scripting.PlatformAdaptationLayer —>
System.TypeLoadException:
Could not load type ‘System.OperatingSystem’ from assembly ‘mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.
at Microsoft.Scripting.PlatformAdaptationLayer…cctor () [0x00000] in
:0
— End of inner exception stack trace —
at IronRuby.Hosting.RubyConsoleHost…ctor () [0x00000] in :0
at Host…ctor () [0x00000] in :0
at Host.Main (System.String[] args) [0x00000] in :0


Does anybody know why this might happen?

Thanks,
Rob

Yep, it was a PATH issue. Seems like cron has an extremely pared down
PATH
compared to regular users! Thanks!