We have a dotnet core script we use to index some files. We leverage RedHat Software Collection so items like dotnet can tie into our RHEL setup.
To run the script, we do the following:
source scl_source enable rh-dotnet30
/opt/rh/rh-dotnet30/root/usr/bin/dotnet /d/h/fileprocessor.dll 1
We want to run this in cron, but we can not get it to work. We have tried the following:
Adding the 'source' command to the bash profile, but this doesn't seem to be reliable for us, and not run on the cron event.
Running this directly in cron
Running this as a shell script in cron
We are at a loss, it seems we can never get the two commands to work together. If we don't include the source command, even if in our profile, it will not run and gives us the error " It was not possible to find any installed .NET Core SDKs
Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
https://aka.ms/dotnet-download"
The following works for me. I am using rh-dotnet31 (.NET Core 3.1) though, since rh-dotnet30 (.NET Core 3.0) is out of support:
Install packages:
$ sudo yum install rh-dotnet31 -y
Start at a known directory
$ cd ~
Create a directory for .NET Core source code to use
$ mkdir hello
$ cd hello
Create a simple application for testing
$ scl enable rh-dotnet31 bash
$ dotnet new console
$ dotnet publish
$ exit # this exits from the subshell started from scl enable command above
Copy the build over to a separate directory where we can run it
$ cp -a bin/Debug/netcoreapp3.1/publish ../hello-bin
Create the script that cron will invoke
$ cd ~
And put this in a ./test.sh file:
#!/bin/bash
echo "test.sh running now...."
source scl_source enable rh-dotnet31
dotnet $HOME/hello-bin/hello.dll 1
You could probably even combine the last two lines (source... and dotnet ...) into scl enable rh-dotnet31 -- dotnet $HOME/hello-bin/hello.dll 1
Then make it executable:
$ chmod +x ./test.sh
Set up the crontab file
$ crontab -e
And then add the line below in this file. This one runs the script every minute.
* * * * * $HOME/test.sh >> $HOME/test.cron.log 2>&1
On my machine, cron is running, so I now see the output of the cron job in the log file after a few minutes:
$ tail -f test.cron.log
test.sh running now....
Hello World!
test.sh running now....
Hello World!
test.sh running now....
Hello World!
test.sh running now....
Hello World!
test.sh running now....
Hello World!
The issue we ran into for this was that the runtime had only been installed, and not the SDK. Once the SDK was installed, which included many other dependencies, it just worked.
Related
Following these instructions
to install the RSK node on an 2021 MBP with Apple M1 Pro chip.
I would like to run an RSK node locally in regtest mode.
After installation, running the command to start RSKj:
java \
-classpath ~/.rsk/rskj-core-3.1.0-IRIS-all.jar \
-Drpc.providers.web.cors=\* \
-Drpc.providers.web.ws.enabled=true \
co.rsk.Start \
--regtest
... results in the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no leveldbjni in java.library.path, /private/var/folders/40/k7t383452q75nkmr_5kl12_80000gn/T/libleveldbjni-64-8276576211622720497.jnilib: dlopen(/private/var/folders/40/k7t383452q75nkmr_5kl12_80000gn/T/libleveldbjni-64-8276576211622720497.jnilib, 0x0001): tried: '/private/var/folders/40/k7t383452q75nkmr_5kl12_80000gn/T/libleveldbjni-64-8276576211622720497.jnilib' (fat file, but missing compatible architecture (have 'x86_64,i386', need 'arm64e')), '/usr/lib/libleveldbjni-64-8276576211622720497.jnilib' (no such file)]
at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:182)
at org.fusesource.hawtjni.runtime.Library.load(Library.java:140)
at org.fusesource.leveldbjni.JniDBFactory.<clinit>(JniDBFactory.java:48)
at org.ethereum.datasource.LevelDbDataSource.init(LevelDbDataSource.java:104)
at org.ethereum.datasource.LevelDbDataSource.makeDataSource(LevelDbDataSource.java:70)
at co.rsk.RskContext.buildTrieStore(RskContext.java:1031)
at co.rsk.RskContext.buildAbstractTrieStore(RskContext.java:951)
at co.rsk.RskContext.getTrieStore(RskContext.java:408)
at co.rsk.RskContext.buildRepositoryLocator(RskContext.java:1073)
at co.rsk.RskContext.getRepositoryLocator(RskContext.java:384)
at co.rsk.RskContext.getTransactionPool(RskContext.java:353)
at co.rsk.RskContext.buildInternalServices(RskContext.java:844)
at co.rsk.RskContext.buildNodeRunner(RskContext.java:836)
at co.rsk.RskContext.getNodeRunner(RskContext.java:302)
at co.rsk.Start.main(Start.java:34)
Looks like the most likely problem is an incompatibility of something within RSKj with my chip architecture.
Is there a workaround that will allow RSKj to run with an M1 chip?
You can try to use Rosetta to run x86 code on M1. Just add arch -x86_64 at the begin of your command.
arch -x86_64 java \
-classpath ~/.rsk/rskj-core-3.1.0-IRIS-all.jar \
-Drpc.providers.web.cors=\* \
-Drpc.providers.web.ws.enabled=true \
co.rsk.Start \
--regtest
You are right, the problem is with the leveldbjni dependency, which is not running on aarch64 architecture. However, one can get around this limitation by running RSK node in a Docker container.
This process is described in detail in the Docker installation instructions on the RSK devportal.
Summary:
You can install Docker running
brew install --cask docker
Register a free Docker account, login to your installed desktop app and then in the terminal run
docker run rsksmart/rskj-standalone
Then you should download Dockerfile.RegTest and supervisord.conf from artifacts repo and in the same folder execute:
docker buildx build --platform linux/amd64 -t regtest -f Dockerfile.RegTest .
When the build finishes, you have a container ready to run RSK. To run the container, you should execute
docker run -d --name regtest-node-01 -p 4444:4444 -p 30305:30305 regtest
Now your local test RSK node will be running ready for testing your smart contracts.
when I build an app with docker the command
RUN rm -f something.txt
in Dockerfile
works fine but using the same command with heroku (heroku container:push web -a ...)
doesn't actually delete the file. No error is produced anyway.
Any solution
Thanks
PS: I also tried RUN shred -u something.txt same issue
I need to run the command line dotnet run, after starting the url localhost, I need to run another command like curl.
I could do like it:
dotnet run & sleep 12; curl http://localhost:59406
but if dotnet run delay more then 12 seconds, it will be stopped.
It may be possible to solve with linux commands, but I am not experienced in this.
If that helps, I will use this when building the Azure DevOps pipeline, to run newman tests on localhost
You can extend the sleep time if dotnet run takes longer to start up your application, to make sure your application is started when curl the url localhost
If you use this in azure devops pipeline, you can use two bash tasks to run above command. The first bash task run dotnet run & to start your application in the background. The second bash task run curl to curl url localhost. See below yaml pipeline example.
- bash: |
#cd ConnectionWeb/ConnectionWeb
#dotnet restore
dotnet run &
- bash: |
curl http://localhost:8881
How to install Airflow on Windows 7? getting below error while installing it using pip install apache-airflow :
---------------------------------------- Command "c:\users\shrgupta5\appdata\local\programs\python\python36-32\python.exe
-u -c "import setuptools, tokenize;__file__='C:\\Users\\SHRGUP~1\\AppData\\Loca l\\Temp\\pip-build-_yptw7sa\\psutil\\setup.py';f=getattr(tokenize, 'open', open) (__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __fi le__, 'exec'))" install
--record C:\Users\SHRGUP~1\AppData\Local\Temp\pip-_cwm0n u7-record\install-record.txt --single-version-externally-managed
--compile" fail ed with error code 1 in C:\Users\SHRGUP~1\AppData\Local\Temp\pip-build-_yptw7sa\ psutil\
I wouldn't bother trying to install Airflow on windows, even after you install it successfully you cannot run the airflow script due to a dependency on the unix-only module pwd
You can run Airflow on Windows by using the Docker setup from puckel https://github.com/puckel/docker-airflow.
Use VirtualBox and Docker Toolbox(legacy) and setup a docker-machine on your Windows computer (docker-machine create -d virtualbox --virtualbox-cpu-count "2" --virtualbox-memory "2048" default)
make sure to fork puckels git repo underneath c:/Users/yourusername/documents otherwise mounting of DAGS won't work
You should now be able to spin up Airflow e.g. by using the celery-executor setup with docker compose -f docker-compose-CeleryExecutor.yml up -d
I have setup a environment where I develop the DAGs on Windows, test them within the dockercontainer and then push the Dockerimage to Linux to production. I have added a more detailed tutorial here.
Airflow cannot be installed on Windows within the standard command prompt.
You need to use bash and afterwards change the config:
How to run Airflow on Windows
Download the source of airflow from pypi:
https://pypi.org/project/airflow/#files
Unzip and edit setup.cfg, then go to the install_requires section and change the version of psutil with the following: 'psutil>=5.4.7',
Finally, run python setup.py install in the source directory
After HDD crash, I had to reimport my symfony2 app into Eclipse from my SVN server.
After syncing everything, I can't use the console anymore. I only get 2 commands : list and help.
I tried:
php bin/vendors install --reinstall
At the end, I got the following message:
[InvalidArgumentException]
There are no commands defined in the "assets" namespace.
[InvalidArgumentException]
There are no commands defined in the "cache" namespace.
My configuration is pretty simple:
- ubuntu server 11.04 (64bits)
- virtualbox OSE
How can I fix it?
Here is the result of app/console list command:
oc#ubuntu-server:/var/www/projets/Simoov2/src$ app/console list
Symfony version 2.0.0-RC4 - app/dev/debug
Usage:
[options] command [arguments]
Options:
--help -h Display this help message.
--quiet -q Do not output any message.
--verbose -v Increase verbosity of messages.
--version -V Display this program version.
--ansi Force ANSI output.
--no-ansi Disable ANSI output.
--no-interaction -n Do not ask any interactive question.
--shell -s Launch the shell.
--env -e The Environment name.
--no-debug Switches off debug mode.
Available commands:
help Displays help for a command
list Lists commands
OK. As I thought, this is not related to symfony2 but related to virtualbox mounting system.