How to run a command automaticly on starting up with systemd

Hi,
I'm using a laptop with two video card, an ATI 3400 and a intel integrated video card.
Several months ago, I use rc.local to disable the ATI 3400 with the command below:
mount -t debugfs debugfs /sys/kernel/debug
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
What should I do to enable these commands with systemd?
Thank You!

brain0 wrote:
yumtaoist wrote:
nomorewindows wrote:Make a .service file and make sure that systemd calls it.
I have write a video.service file like below
[Unit]
Description=Disable the Discrete Graphics
Requires=sys-kernel-debug.mount
After=sys-kernel-debug.mount
[Service]
Type=oneshot
ExecStart=echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
And the result of "systemctl is-enabled video.service" is static
However, this just does not work. I'm not familiar with systemd.
Buy the way, thank you!
First of all, put this into /etc/systemd/system/. Then add an install section to this unit:
[Install]
WantedBy=multi-user.target
or
[Install]
WantedBy=basic.target
(No idea which one is better). Then run:
# systemctl daemon-reload
# systemctl enable video.service
Last edited by brain0 (2012-10-27 20:09:25)

Similar Messages

  • How to run rmiregistry each time windows starts

    Can anybody tell me how to run rmiregistry each time windows starts.
    I want to start my RMIserver automatically to work.First I need to start rmiregistry then I want to start my RMIServer class as windows service.

    Stick a shorcut to it in your Startup folder or create a new Key in the registry @ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
    If you have arguements to rimreg (like port number) create a .bat script and use that to launch it.

  • How java runs in command prompt and why java runs on it

    how java runs in command prompt and why java runs on it

    command prompt was used before the development of IDEs like RAD,eclipse etc.
    its still used for better understanding of the compilation and errors.
    type the java file and save the file(source file) in the bin folder of ur jdk environment with extension .java. the source file must be the one that has the main method declared.
    in the cmd prompt screen , set the path of bin folder.
    eg:C:/program files/jdk(some version)/bin/...
    for compilation,type:
    javac (source file_name).java and press enter
    for running the file:
    java source file_name

  • What i want is when i run bsp application automatically is should open with

    Hi friends,
    In BSP when we run a application the browser will open.
    When it open if i want to full screen i have to press F11.
    What i want is when i run bsp application automatically is should open with fullscreen -F11.
    How to code this in BSP.
    Pls suggest.

    Not exactly full screen but resizing to maximum:
    <S CRIPT language=JavaScript1.2>
    <!--
    * Auto Maximize Window Script- &copy; Dynamic Drive (www.dynamicdrive.com)
    * This notice must stay intact for use
    * Visit http://www.dynamicdrive.com/ for this script and 100's more.
    top.window.moveTo(0,0);
    if (document.all) {
    top.window.resizeTo(screen.availWidth,screen.availHeight);
    else if (document.layers||document.getElementById) {
    if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
    top.window.outerHeight = screen.availHeight;
    top.window.outerWidth = screen.availWidth;
    //-->
    </S CRIPT>
    In the code remove the space between s and cript

  • How to start dhclient with systemd at startup? [SOLVED]

    I have eth0 connected to DHCP server and want to use dhclient instead of dhcpcd. How can I start dhclient with systemd? Is there something similar to
    systemctl enable dhcpcd@eth0
    Last edited by mpelikan (2012-12-18 13:43:28)

    dhcpcd comes in package with completed systemd unit (/usr/lib/systemd/system/dhcpcd.service and /usr/lib/systemd/system/[email protected]) by package developer, but dhclient doesn't.
    mpelikan, you should write your own systemd unit for dhclient for yourself using
    1) dhcpcd units as example
    2) wiki page https://wiki.archlinux.org/index.php/Sy … vice_files
    3) man page for dhclient to get the right options
    Also I'm sure I saw somewhere an example of dhclient unit but I can't find it now. Anyway, it was not working out-of-box in Arch.
    I've done this previously but then I've realized disadvantages of dhclient (so I've removed it).
    Firstly, I didn't like how it's working in daemon-mode after some testing.
    Secondly, it depends on deprecated net-tools.
    You should try dhcpcd. If it doesn't work, you can make it work by editing configuration files / kernel options (like switching off IPv6 if you think you have an issues with it) or adding some parameters.

  • How to run ADF command-line test-client on standalone weblogic host

    I have followed the steps to create a test client for the ADF application. In used the following link:
    http://download.oracle.com/docs/cd/B31017_01/web.1013/b25947/bcquerying007.htm
    The above link does not talk about how to setup the environment where the standalone weblogic is installed to be able to run the test client.
    I can run it in the jdeveloper environment.
    I can also run from the command line on the development host, by cut-paste the command from the jdeveloper output log tab.
    I am trying to run this client on the machine where we have a weblogic installed (standalone) for testing. We can run our ADF application from the browser with no issues. We want to automate and run some testing related to the ADF model (non-viewcontroller part) from the command line on this test stage.
    Which/Where are the ADF libraries?
    How can I add our application jar deployed on the weblogic (ear file) to the CLASSPATH?
    What other libraries ADF/Weblogic do I need for the command line test client?
    What am I missing?
    Thanks for any help.
    Edited by: mmunawar on Jul 2, 2011 1:03 PM
    Edited by: mmunawar on Jul 2, 2011 1:04 PM

    create weblogic application server connection from jdeveloper and then Deploy that application through jdeveloper in the weblogic application server and then run it from jdeveloper and see if its working.

  • How do run unix command in java

    hi
    All unix command working fine in our java program.
    but i want change user in linux by using java. it's not working.
    "su root" This command onely not working.
    anybody know help me
    This is my ID [email protected]
    This my code
    <% String s = null;
    try{
    Process p = Runtime.getRuntime().exec("su root");
    BufferedReader stdInput = new BufferedReader(new
    InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new
    InputStreamReader(p.getErrorStream()));
    out.println("Here is the standard output of the command:\n");
    while ((s = stdInput.readLine()) != null)
    out.println(s);
    catch(Exception e) {}
    %>

    I don't have further info to add to your first post, but think your guess seems quite reasonable. I thought of starting a new thread on the same topic, but think this (question) fits in here, too.
    I have Java code (freeware, not opensoure), intended for Unix, which basically provides the graphical interface and relies on an I/O layer (C + shell scripts) to do most of the work. I have access to the C+shell scripts which are opensource. I ported it to Cygwin and want to use it under Windows (there is no Cygwin native Java VM).
    My problem now boils down to " how to run commands under Unix and what differences are there with Windows". What are the variants?
    I have to guess what the program is doing when I get an IOException at some point. E.g.: a call to shell script may be made in a different way as to a compiled exe in Unix?. I found a way to bypass path problems because forward slashes are also accepted and /cygdrive/c construct can be replace by c:/; shell scripts can be compiled into exes using shc and they work; if symbolic links are replaced by duplication of exe files, they work. What will happen in an instance whereby a process runs a shell script dynamically, through a pipe (the shell script is compiled in the Cygwin/win version and receives parameters) in a construct like:
    pipefp = epopen(cmdbuf,"w"); /* (cmbuf is "makehdr par1 par2 ... ") (makehdr was a shell script and is now compiled exe for Cygwin/Windows) */?.
    Thanks.
    LT

  • How to run Terminal commands in Xcode?

    Anyone knows how to include Terminal commands ( like sudo) in Xcode?  for example in a line of my program I need to run this:
    sudo open/Library/Preferences/com.apple.sharing.firewall.plist
    I searched the library but found no class or routine for that.

    Well, I am not a professional programmer, but one of the things I continue to learn is how to wade through all of the Cocoa documentation (and it does get deep in spots).  Chances are though, no matter what you are trying to do, Apple or some third party has created a class to make it easier - you just have to find it.  My Xcode documentation bookmarks continue to grow, but you might start with some of Apple's documentation, such as
    Cocoa Fundamentals Guide
    Foundation Framework Reference
    Application Kit Framework Reference

  • How to run webi report automatically with the current date/system date in webi report

    Hi Friends,
    I have a webi report which has a date prompt now. Based on the selection that user makes while running a report, he will get the related data for that particular date selection. Now I want to make that date prompt automated that is the report should run automatically based on the system date daily on scheduling.
    I want it to run current day automatically without have to go in and pick the date in webi report. I will be scheduling the webi report. Can you please let me know how to achieve this functionality of running a webi report automatically with a system date.
    Please let me know if I couldn't make you understand so that I will write with an example.
    Waiting for your valuable solutions.
    Thanks in advance.
    Regards,
    Bhaskar

    Hello Bhasakar,
    1.Create sysdate object in the universe
    2.Create another query in webi and select only sysdate object
    3.In the original query drag the Day object in the filter pane and choose the "List of values" from another query.and select the sysdate object from the second query.
    So your report always will run for sysdate...
    regards,
    Naveen D

  • Please help how to run System commands and batch files thru java program

    Sir,
    I want execute OS commands like dir,cls..etc and batch files,.exe filesthru java program.
    I have tried it sofar thru Runtime.getRuntime().exec("execute.bat");
    but it is not working.anybody knows about how to run the system commands thru java please give me the code.
    thank you,
    regards,
    j.mouli

    I've seen other posts with this questions, and answers. Unfortunately I didn't pay much attention. But the basic idea is to exec command.com and pass the specifc batch or command as an argument.

  • How to Run a Report automatically in Background for every night

    Hi,
    How to run a report program in Background automatically for every nigh.
    Thanks
    Ramesh

    Hi Ramesh,
    You can use SM36 and use the "Job Wizard" to define a background job in simple step by step procedure
    Or
    Goto SM37 and specify a job name.
    Next specify the ABAP Program Name of the report you want to execute under Job Step.
    Then click on "Extended Job Selection" and goto the Period Tab.
    There select "Only Periodic Jobs" and then specify the frequency of execution based on Months, Weeks, Days, Hours or Minutes.
    Hope this helps,
    Regards,
    Madhur
    Message was edited by: Madhur Chopra

  • How to run a command line window from code?

    In an application I need to run a dll file with a few arguements. These arguements can be given in the command line window. The execution of the dll file will return a string that i need to get (for the parsing etc).
    1. How can I open a command line window from the Java code?
    2. How to run commands on it?
    3. How to get the results of the commands from the command line into my program?

    In an application I need to run a dll file with a few
    arguements. These arguements can be given in the
    command line window. The execution of the dll file
    will return a string that i need to get (for the
    parsing etc).
    A dll is used by other programs. It is not possible to run it from the command line.

  • How to run zonecfg command-line to add device in postinstall script?

    I want to assign a tape drive in non-global zone in postinstall script. I can run zonecfg with a command-file, but don't know how to run zonecfg to add device in a whole command-line.
    The command-line fails to run:
    # zonecfg -z sun1 add device set match=/dev/rmt/173b
    syntax error at 'set'
    Commands:
    add <resource-type>
    (global scope)
    add <property-name> <property-value>
    (resource scope)
    cancel
    commit
    create [-F] [ -b | -t <template> ]
    delete [-F]
    end
    exit [-F]
    export [-f output-file]
    help [commands] [syntax] [usage] [<command-name>]
    info [<resource-type> [property-name=property-value]*]
    remove <resource-type> { <property-name>=<property-value> }
    (global scope)
    remove <property-name>=<property-value>
    (resource scope)
    revert [-F]
    select <resource-type> { <property-name>=<property-value> }
    set <property-name>=<property-value>
    verify
    Thanks for your help!

    Quote the parameters and embed the newlines:
    zonecfg -z sun1 'add device
    set match=/dev/rmt/0
    end'

  • How to run a command prompt " command " through java code

    hi all,
    There is a command
    "java -jar selenium-server.jar -interactive"
    which i am running through command prompt after going to D:\MyFolder\Examples .
    i want to execute this command using java code .please help

    This has already been answered in your other two threads on this topic - http://forum.java.sun.com/thread.jspa?threadID=5221221&messageID=9898287#9898287 and http://forum.java.sun.com/thread.jspa?threadID=5221223&messageID=9898290#9898290.
    For some reason you don't want to read the reference that tells you exactly how to do what you want and how to avoid the pitfalls - http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html .

  • How to run DOS command in Java environment?

    Can i run DOS command in Java environment?
    I did like this:
    Runtime r = Runtime.getRuntime();
    r.exec("cmd.exe");
    r.exec("set classpath=%CLASSPATH%;.\\tmp")
    but failed.
    However if I run the java command, it runs successfully.
    r.exec("javac Test.java");
    r.exec("java Test");
    how should I do so that i can run the DOS commands metioned above in Java Environment?
    thanks a lot.

    Have a look at http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    This may help. I wonder if this is ok ?
    Runtime r= Runtime.getRuntime();
    r.exec("cmd.exe /C set classpath=%CLASSPATH%;.\\tmp\"");

Maybe you are looking for

  • How do I get Snow to work with MacBook Pro running Tiger?

    I have a MacBook Pro running Tiger (obviously), and have been trying to get my Snow base station (a.k.a. Dual Ethernet) to work with it, but couldn't. After hours of searching these pages, Apple Support and Google, I found this: http://docs.info.appl

  • Performance point Filter error : " There was a problem preparing the WebPart for display"

    I'm going to create a performance point filter .I chose "Custom Table" type to select Project Name for my reports. I have some reports which have Project Name (ProjectUID as value) as parameter .So I'm going to create a filter based on Project Name (

  • EDI output triggered for old PO

    Hello All,   on 09.09.2014, EDI ( output type NEU, transmission medium 6) output type has triggered for more than 700 PO's which has been created in 2012 for several vendors and sent to supplier again as a duplicate copy. Suppliers are reaching clien

  • Application monitor node display off

    Hi All, I am using SRM 4.0. Strangely I am running into lot of troubles in SRM since yesterday as there was a mess up in the batch jobs. Now, we are having an issue with Application monitor. It is not showing any error message in ITS, but I could see

  • Elements 13 Organizer funktioniert nicht mehr

    Nach meinem Update von Photoshop Elements 9 auf die Version 13 habe ich folgendes Problem: Nachdem man einmal den Internen Editor aufgerufen hat (der erscheint erst nicht, sondern nur eine kurze Meldung, die dann irgendwann wieder verschwindet) arbei