# Tag Info

9

You need IF EXIST instead of just IF for batch programming. e.g. IF NOT EXIST "C:\Program Files\Microsoft Security Client" ( :: Install product )

7

Running sudo su user01 in a script does not mean the following commands are sent to the resultant shell. In fact, it likely means a new shell is spawned as user01, which never exits! Two things: You can execute a command as another user either by passing the -c 'command...' argument to su, like su user01 -c '/etc/init.d/script start'. Starting a service ...

6

In PowerShell: Import-Module ActiveDirectory Get-ADUser MDMarra -Properties scriptpath | Select scriptpath In cmd: dsquery user -samID MDMarra | dsget user -loscr This will return the path of the logon script set in the Profile tab of ADUC. or Just install ADUC on your workstation and look at the Profile tab for the user in question. You don't need ...

6

You might want to look at achieving this via two separate methods, i.e. one to set FF as default, the other to launch it at login. That said, in case you want to know, default browser setting is stored in the registry under HKEY_CURRENT_USER\Software\Classes\http\shell\open\command Use your preferred method for setting registry entries (with your ...

6

Your understanding is correct. When your company gets to the size that you need to bring in a dedicated Windows sysadmin they're going to be unhappy that you did this. I can't imagine that your logic is so complex that it couldn't be solved by the built-in functionality in Group Policy. Security Group filtering, WMI filtering (which is ...

6

You probably have a carriage return (^M) at the end of your #! line. The format of the #! line is very strict, and carriage return is not allowed there, unless your interpreter is actually called /bin/bash^M There will never be carriage returns in a file created with a proper unix editor, unless you go out of your way to add them. When editing an existing ...

5

Group Policy Filtering: You're doing it wrong (or at the very least you're doing it the hard way). Create a Security group for the computers that you DO want the policy to apply to. Add the appropriate computer accounts to the group. On the Scope tab of the GPO, in the Security Filtering section, remove all entities and add the Security group you created ...

5

You could put something in /etc/crontab and run it @reboot @reboot username /etc/init.d/script start

4

Sorry for not answering (my own question) sooner. So, this is how I finally settled my problem. On Startup, the Startup Script creates an at job. Since Startup Scripts run as SYSTEM, the at job will similarly run under SYSTEM privileges. The at job is configured to run 2 minutes after creation. The command in the at job is the actual workload script. ...

4

I do what you're looking at doing all the time. When you say "I then set permissions on the GPO to deny access to that group" it's not clear what you're doing. Here's my workflow for denying a group the rights to apply a GPO: Create Global Security Group "Computers exempt from printer deletion" Open Group Policy Management, locate the GPO to delete ...

4

Put the command in /etc/rc.local.

4

Since you're running AD, why don't you try distributing these products via MSI and GPO?

3

You need to transition this to a logon script, or use the built in application deployment options. The problem you are running into is that during the start up script phase the effective user is not the logged in user - since these scripts are run even before the user logon prompt is presented - but it is running as the SYSTEM user. Personally I would ...

3

On the CentOS machine, create a file in your home directory named .bashrc and set your environmental variables in there. For example, the contents of the file can be: export VARIABLE=foo Here's some discussion of this: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_01.html  Thanks for the clarification. You can use the SendEnv and ...

3

Take a look at the logger command.

3

I suppose the shell TERMs it when it exits, which would be immediately, due to the '&'. Maybe you want to use start-stop-daemon? E.g: start-stop-daemon --start -b -x /usr/bin/Xvfb :1 I suppose if you want the help of the startx wrapper, you may want to run your shellscript instead.

3

Assuming startup script is a batch file: The CALL statement was introduced in MS-DOS 3.3 It is used to call other batch files within a batch file, without aborting the execution of the calling batch file, and using the same environment for both batch files. http://www.robvanderwoude.com/call.php

3

If your service already has an init script, you can add it to the default runlevel by running: # rc-update add apache2 default If not, depends on which services system you're using, add your scripts to the /etc/conf.d/local.start or /etc/local.d/baselayout1.start, something like this: cd /path/to/your/app && thin start

3

Modify /etc/init.d/boot.local to add what you want.

3

As drive letters are ephemeral, it would be best to use UNC paths instead of drive letters. If the service is unable to handle UNC paths, consider creating a symlink to the destination like mklink c:\remotenetdir \\server\remote\netdir and use the local path (c:\remotenetdir) in the service configuration. Obviously, the service account would need to have ...

3

The services on a CentOS operating system are managed using chkconfig. Use chkconfig --list to review the currently managed services. You can mark a service to automatically start at a defined runlevel by issuing: # chkconfig someservice on Read the chkconfig(8) manpage for the details.

2

Since, you're running Ubuntu, you can wrap memcache tasks into an Upstart configuration. The "hook" to invoke a script after memcached starts would be in the post-start section of the Upstart configuration. Your config will then look something like: # memcached - in-memory cache # description "memcached" start on (local-filesystems and started ...

2

They are loaded based on hardware detection. In the case of your e1000e module the hardware in your machine, whether it is on board or a plugin card, will identify itself with a PCI vendor ID and device ID pair and those will be matched against the available modules and any module identifying itself with that ID will be loaded. You can see the IDs ...

2

Create a separate Systemd init script for the processes. For process A create the file /etc/systemd/system/A.service and add something like this to it: [Unit] Description=Process A After=network.target [Service] User=userA Type=forking ExecStart=/some/command/to/run --arg1 --arg2 Restart=on-failure StartLimitInterval=5min StartLimitBurst=4 [Install] ...

2

rc startup order is determined by rcorder, as you've already determined. This process for determining startup order is automatic, and the man page for rcorder is relatively self-explanatory, but you may will want to spend some time reviewing Practical rc.d scripting, and the rc man page before making any changes. In your particular case, you can tell ...

2

While using RVM you have to create an rvm wrapper for thin with rvm wrapper <ruby_version>@<gemset> bootup thin and edit DAEMON variable at /etc/init.d/thin. The actual solution I found here

2

You should grab a copy of psexec and run psexec -s path\to\script.bat. That will run it as System. That's a more accurate manual test than running it as the logged in user, since startup scripts run as SYSTEM.

2

I'm making an assumption that you are also using a newer model of Active Directory but you could easily create a GPO to do software deployment and then use item-level targeting on it to ensure the software is only deployed to users of a specific group or however you want to deploy them.

2

To add apache2 at boot time: $rc-update add apache2 default To start the script manually$ /etc/init.d/apache2 start Also a really useful command is rc-update -v show which will show all the available init scripts and list at which runlevels they will execute.

2

You can use my init script. It's based on /etc/init.d/skeleton and seems to work well: #! /bin/sh ### BEGIN INIT INFO # Provides: Xvfb # Required-Start: $remote_fs$syslog # Required-Stop: $remote_fs$syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start Xvfb. # Description: Start the X virtual ...

Only top voted, non community-wiki answers of a minimum length are eligible