Tag Info

Hot answers tagged

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

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

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

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

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


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 ...


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?


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 ...


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 [edit] Thanks for the clarification. You can use the SendEnv and ...


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

Hmmm... What you're doing should work. That's not much consolation, I know, but I use a LOT of startup scripts (thousands of invocations on client comptuers throughout my Customer sites every day) and I don't have problems with script execution reliability. I'd add an "On Error Goto 0" after the registry read so that any other errors in the script execution ...


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 ...


2

Don't be afraid of pidfiles, of they're tried and true and typically owned by root! :) Most distributions use a standard function or binary to launch daemons and store the resultant PID in a file. In Debian, for example, you have start-stop-daemon with the --pidfile option. Other distributions have /etc/rc.d/init.d/functions (or similiar) that are used ...


2

A nice idea would be to use a simple bash wrapper script that writes a lock/pid file of that application (commonly used in webservers or databases) and then use that file to kill exactly this one process if needed.


2

Make sure your script is runnable. (chmod +x) But why would you use a script to mount it? You can add it to /etc/fstab.


2

It's unclear to me what you're trying to do and I think you're taking the wrong path to get there. The contents of Startup Scripts aren't cached by clients. The client does cache the path to the script, but not the content of the script itself (any executable could be used as the script and there might be dependencies on files besides the "script" itself). ...


2

Have your script drop a flag, create a text file or something, when the install completes that your script will look for on the subsequent runs. If it finds the flag it ends the process and doesn't re-install. If the flag doesn't exist it completes the install.


2

Since you're trying to restrict access to Domain Users to an intranet website, wouldn't it be easier to restrict access to the directory via your Active Directory Controller instead of using a static htaccess file? This way, you can allow certain users to access the website directory where as other users would be denied by default. Change the Everyone ...


2

In order to log all the output to a file, i.e., add the following to all your commands in rc.local: >> /var/log/rc.local.log 2>&1 This will collect both stdout and stderr to /var/log/rc.local.log then you should be able to know what happened.



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