Schedulers in Linux vs CFS
In linux, which are the differences between sched_rr,sched_fifo,sched_other and the Completely Fair Scheduler ?
See also questions close to this topic
-
Linux command Sort for special fields
When I try to use linux command sort to sort the sentences in a file like:
10:01 [aa:bb] {0:123:123245} log1 10:01 [cccc] {1:123:3432} log2 10:01 [dddd] {0:124:123} log3
What I'm expecting to see is
10:01 [cccc] {1:123:3432} log2 10:01 [aa:bb] {0:123:123245} log1 10:01 [dddd] {0:124:123} log3
Meaning the specific fields to be sort are the the second and the third fields (separated by ":") in the "{}", for example "123:3432" in the first line.
However I don't know how to tell "sort" to separate the specific fields.
-
Import Remote Source Files in Bash
I have a file in my VM called
color.sh
:#!/bin/bash # -------------------------------------------------------------------------------- # Goal : include all color # Run : curl 45.55.88.57/code/color.sh | bash # grap user input first argument # ------------------------------ #================================ # Colors = #================================ declare -A colors # Reset colors[Color_Off]='\033[0m' # Text Reset # Regular Colors colors[Black]='\033[0;30m' # Black colors[Red]='\033[0;31m' # Red colors[Green]='\033[0;32m' # Green colors[Yellow]='\033[0;33m' # Yellow colors[Blue]='\033[0;34m' # Blue colors[Purple]='\033[0;35m' # Purple colors[Cyan]='\033[0;36m' # Cyan colors[White]='\033[0;37m' # White # Bold colors[BBlack]='\033[1;30m' # Black colors[BRed]='\033[1;31m' # Red colors[BGreen]='\033[1;32m' # Green colors[BYellow]='\033[1;33m' # Yellow colors[BBlue]='\033[1;34m' # Blue colors[BPurple]='\033[1;35m' # Purple colors[BCyan]='\033[1;36m' # Cyan colors[BWhite]='\033[1;37m' # White # Underline colors[UBlack]='\033[4;30m' # Black colors[URed]='\033[4;31m' # Red colors[UGreen]='\033[4;32m' # Green colors[UYellow]='\033[4;33m' # Yellow colors[UBlue]='\033[4;34m' # Blue colors[UPurple]='\033[4;35m' # Purple colors[UCyan]='\033[4;36m' # Cyan colors[UWhite]='\033[4;37m' # White # Background colors[On_Black]='\033[40m' # Black colors[On_Red]='\033[41m' # Red colors[On_Green]='\033[42m' # Green colors[On_Yellow]='\033[43m' # Yellow colors[On_Blue]='\033[44m' # Blue colors[On_Purple]='\033[45m' # Purple colors[On_Cyan]='\033[46m' # Cyan colors[On_White]='\033[47m' # White # High Intensity colors[IBlack]='\033[0;90m' # Black colors[IRed]='\033[0;91m' # Red colors[IGreen]='\033[0;92m' # Green colors[IYellow]='\033[0;93m' # Yellow colors[IBlue]='\033[0;94m' # Blue colors[IPurple]='\033[0;95m' # Purple colors[ICyan]='\033[0;96m' # Cyan colors[IWhite]='\033[0;97m' # White # Bold High Intensity colors[BIBlack]='\033[1;90m' # Black colors[BIRed]='\033[1;91m' # Red colors[BIGreen]='\033[1;92m' # Green colors[BIYellow]='\033[1;93m' # Yellow colors[BIBlue]='\033[1;94m' # Blue colors[BIPurple]='\033[1;95m' # Purple colors[BICyan]='\033[1;96m' # Cyan colors[BIWhite]='\033[1;97m' # White # High Intensity backgrounds colors[On_IBlack]='\033[0;100m' # Black colors[On_IRed]='\033[0;101m' # Red colors[On_IGreen]='\033[0;102m' # Green colors[On_IYellow]='\033[0;103m' # Yellow colors[On_IBlue]='\033[0;104m' # Blue colors[On_IPurple]='\033[0;105m' # Purple colors[On_ICyan]='\033[0;106m' # Cyan colors[On_IWhite]='\033[0;107m' # White
I want to import it into my other shell scripts. I'm not sure how to achieve that.
I've tried calling it on other script:
bashrc.sh
curl 45.55.88.57/code/color.sh | source color=${colors[$input_color]} white=${colors[White]} export PS1='$white┌──[$color\u$white@$color\h$white]──$white[$color\w$white] \n└── $white'
It doesn't work.
Any hints for me?
-
How to execute from any directory Bash script that sources other Bash scripts (not using path variable)
I am not trying to execute a Bash script from any directory by adding the script to my Path variable.
I want to be able to execute the script from any directory using the directory path to that file ... but the file I want to execute sources other files, that is the problem.
If I am in directory
file
with two scriptsmyFunctions.sh
andsourceFunctions.sh
sourceFunctions.sh
#!/bin/bash source ./myFunctions.sh echoFoo
myFunctions.sh
function echoFoo() { echo "foo" }
I can run
myFunctions.sh
andfoo
will print to console, but If I go up a directory and runmyFunctions.sh
I get errorcd .. file/sourceFunctions.sh -bash: doFoo.sh: command not found
Unless I changed
source file/myFunctions.sh
tosource file/myFunctions.sh
insourceFunctions.sh
.So how can I source independent of my working directory so I can run
sourceFunctions.sh
from any working directory I want?Thanks
-
Can two process share same physical page?
Can OS map same physical page to different processes page tables? Can processes share same physical page? If they share same page, can one process can corrupt other processes data and code?
-
How to correctly read in meta data file
I am given a mdf in the format such as the example I typed below. I need to be able to read this in, and print it back out and I need to use the number at the end of each item for later manipulation. How should I go about reading in this file? Writing my code in C++.
Start Program Meta-Data Code: S{begin}0; A{begin}0; P{run}11; M{allocate}2; O{monitor}7; I{hard drive}8; I{scanner}8; O{projector}20; P{run}6; O{projector}4; M{block}6; I{keyboard}17; M{block}4; O{projector}8; P{run}5; P{run}5; O{hard drive}6; P{run}18; A{finish}0; S{finish}0. End Program Meta-Data Code.
-
Shut down isn’t working on Kali Linux 2019.1
I’m quiet new at Kali Linux and I have problem when I shut down or restart system, it hangs on desktop, cursor disappears. Can someone help me?
Some information: Kali 2019.1 installed on USB Kingston dt SWIVL, notebook acer windows 10. Hybrid video cards.
-
UnknownHostException after scheduling with Spring Boot
I am trying to pull prices of crypto-currencies through CryptoCompare API in an one-minute interval. First, a simple Spring Boot app does that once without a problem, and I get this response, as expected:
{ "BTC": {"USD": 3949.37}, "XRP": {"USD": 0.3289}, "ETH": {"USD": 146.59}, "LTC": {"USD": 50.81}, "XMR": {"USD": 51.54} }
However, when I put that identical code in a Spring Boot scheduler, I get:
java.net.UnknownHostException: min-application.api.cryptocompare.com
Point of breaking is this:
Response response = client.newCall(request).execute();
The beginning of this class is here:
@Component public class ScheduledTask { static String url = "https://min-api.cryptocompare.com/data/pricemulti?fsyms=BTC,XRP,XMR,LTC,ETH&tsyms=USD&api_key=***************************"; static OkHttpClient client = new OkHttpClient(); @Autowired private CryptoPriceService cryptoPriceService; @Scheduled(fixedRate = 500) public void getPricesNow () throws IOException { Request request = new Request.Builder() .url(url) .build(); Response response = client.newCall(request).execute();
And this is a stack trace:
java.net.UnknownHostException: min-application.api.cryptocompare.com at java.net.InetAddress.getAllByName0(InetAddress.java:1281) ~[na:1.8.0_201] at java.net.InetAddress.getAllByName(InetAddress.java:1193) ~[na:1.8.0_201] at java.net.InetAddress.getAllByName(InetAddress.java:1127) ~[na:1.8.0_201] at okhttp3.Dns$1.lookup(Dns.java:39) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:171) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.connection.RouteSelector.nextProxy(RouteSelector.java:137) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.connection.RouteSelector.next(RouteSelector.java:82) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:171) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.1.jar:na] at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.8.1.jar:na] at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) ~[okhttp-3.8.1.jar:na] at okhttp3.RealCall.execute(RealCall.java:69) ~[okhttp-3.8.1.jar:na] at application.tasks.ScheduledTasks.getPricesNow(ScheduledTasks.java:36) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201] at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_201] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_201] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_201] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_201] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_201] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_201] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]
Not sure this means anything, but here is the response from nslookup:
$ nslookup min-application.api.cryptocompare.com Server: 127.0.0.53 Address: 127.0.0.53#53 Non-authoritative answer: *** Can't find min-application.api.cryptocompare.com: No answer
I must repeat that I can get the expected response from the first app, and from Postman also.
-
Windows event for a printing
I'm a total newbie in Windows task-scheduling and event handling and I'm trying to schedule a task to happen when my computer is printing a document. Is there a Windows event for this? Otherwise, is it possible to create one using Batch or PowerShell?
-
How to schedule to run SQL script on SQL Server?
I want to use MS SQL Transact-SQL to schedule to run a script
C:\script\my_script.sql
at 6 pm every day, except Saturday and Sunday.Then, the result is saved in the folder
C:\data\xxx.csv
wherexxx
is the date of running the script, e.g.2019-2-18
.Furthermore, how to delete the schedule task?
I used server agent but I cannot view the text.
Thank you very much.