Having a game object de-activate itself

To have a script stopped in a game object, is it possible to have the script tell the same game object to deactivate itself?

gameObject.active = false;

or if you want to do it once the script is set to disabled

void OnDisable()
{
      gameObject.active = false;
}

Not this will only affect the gameObject the script is attached to… if you want to apply the effect to all children also

 gameObject.SetActiveRecursively(false);